WordPress.org

Support

Support » Plugins and Hacks » mod rewrite to modify URI for static page

mod rewrite to modify URI for static page

  • I am adding static pages to my site by adding additional .php files and linking to them. In order to maintain flexibility in the future, I want to link to these and have the search engines find them without the .php file extension.
    In other words, my about page, which is /about.php should be referenced by the URL “/about” .
    How would you do this using mod rewrite / htaccess?
    Thanks – been struggling with this for a while.

Viewing 3 replies - 1 through 3 (of 3 total)
  • In 1.3, a new page results in this rewrite rule being generated:
    RewriteRule ^rhino/?$ /T2/index.php?pagename=rhino [QSA,L]
    That help ?
    (I know nothing of rewrite rules, I’m just playing with 1.3)

    Tried it and it works – Thanks!
    I ended up also using a simple straight forward approach: using mod rewrite rules specifically for each file I want to rename – I don’t have so many so it is not a problem:
    ie:
    RewriteRule ^/about/$ about.php [L]
    repeated for each file where I want to hide the extension – brute force, but hopefully will not cause problems with other files.
    etc

    Keep in mind that while that will work for /about/ it won’t work for /about 😉 Need to get the question mark in there I believe (or add a separate rule without the trailing slash..) Also, you shouldn’t start off with a / I don’t think it’ll work that way.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘mod rewrite to modify URI for static page’ is closed to new replies.
Skip to toolbar