• I am attempting to use WordPress in a blog/CMS situation. I have WordPress installed in the /wordpress/ directory of my server. To access the About page, you currently have to go to /wordpress/about/ but I would like a rewrite rule so the user can go to /about/ to hit the page. I tried this rule:

    RewriteRule ^about/?$ /wordpress/about/

    And it failed and I don’t know why. Put this in the .htaccess in the / root directory of web server. I want it done manually for various reasons. I want to be able to access my blog (i.e. /wordpress/) from /blog/ – how can this be done with rewrite?

    Thanks

    Seb

Viewing 3 replies - 1 through 3 (of 3 total)
  • This is just a partial answer…
    I want to be able to access my blog (i.e. /wordpress/) from /blog/

    The easiest way > rename the wordpress directory to “blog”.
    (Warning: you have to change the URI values in Options > General before doing it!)

    Thread Starter sebpayne

    (@sebpayne)

    Thanks moshu but that isn’t what I want. Because I have static pages too, their address with be /blog/about/ for example. Therefore, I will still have to manually edit my .htaccess to include these rules.

    Does anyone have examples or experience of this matter?

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    I tried this rule:

    RewriteRule ^about/?$ /wordpress/about/

    And it failed and I don’t know why.

    Assuming you put this in the .htaccess in the root, and you have your blog directory in /wordpress, then it failed because the setup is wrong.

    The .htaccess in the WordPress directory is not being included because it’s not in the originally requested path. So the final rewrite doesn’t cause WordPress’s .htaccess rules to take effect, so the permalink you’re rewriting to (/wordpress/about/) doesn’t actually get evaluated as a permalink by the WordPress code. It would work if you did a redirect ([R]), but that would cause the client browser to change the page URL, which is probably not your goal.

    So rewrite to the explicit page URL instead. That would be /wordpress/index.php?page=## , where ## is the ID number of the page.

    Understanding how .htaccess’s are evaluated is essential to understanding URL Rewriting. I’d look up the Apache documentation if I were you, might find it useful.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Manual mod_rewrite Rules’ is closed to new replies.