Any htaccess / mod rewrite pros around?

2 replies
  • WEB DESIGN
  • |
Hey guys,

Got a little mod rewrite question I can't quite figure out. I'm trying to setup my htaccess file so that whenever someone accesses a particular webpage that contains a query string in the URL, it will display just the part of the URL before the query string.

For example, whenever this webpage is accessed...

www.mywebsite.com/pageX.php?name=john

...I want it to display the following URL in the address bar...

www.mywebsite.com/pageX.php

I did some web research and figured out how to get mod_rewrite to hide the query strings for *all* pages on my site, but what I want is to do this for *only* 1 page on my site (pageX.php).

Any ideas?
#htaccess #mod #pros #rewrite
  • Profile picture of the author mojojuju
    This should do it...

    RewriteEngine On
    RewriteCond %{QUERY_STRING} .
    RewriteRule ^pageX.php(.*)$ http://www.YourDomain.com/pageX.php$1? [R=301,L]
    Signature

    :)

    {{ DiscussionBoard.errors[1862199].message }}
    • Profile picture of the author Brandon Tanner
      Originally Posted by mojojuju View Post

      This should do it...

      RewriteEngine On
      RewriteCond %{QUERY_STRING} .
      RewriteRule ^pageX.php(.*)$ http://www.YourDomain.com/pageX.php$1? [R=301,L]
      Thanks, mojojuju! Works great
      Signature

      {{ DiscussionBoard.errors[1862326].message }}

Trending Topics