WordPress.org

Ready to get started?Download WordPress

Forums

mod rewrite to modify URI for static page (4 posts)

  1. robgreeley
    Member
    Posted 9 years ago #

    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.

  2. Mark (podz)
    Support Maven
    Posted 9 years ago #

    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)

  3. robgreeley
    Member
    Posted 9 years ago #

    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

  4. Brak
    Member
    Posted 9 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.