Mobile app version of vmapp.org
Login or Join
Shanna517

: Re-write contact-us as contactUS.php. Redirect contactUS.php to contact-us. Edit: Redirects and rewrites are 2 different things. In a redirect, the URL change happens client-side. In a rewrite,

@Shanna517

Re-write contact-us as contactUS.php.

Redirect contactUS.php to contact-us.

Edit:

Redirects and rewrites are 2 different things. In a redirect, the URL change happens client-side. In a rewrite, the URL change happens entirely server-side. I.e.:

Redirect

Client: GET /foo
Server: Location: /bar
Client: GET /bar
Server: [/bar]


Rewrite

Client: GET /foo
(Server: /foo --> /bar)
Server: [/bar]


So if you set up the above rewrite and redirect rules, the client will always navigate to /contact-us, while the server will always serve up /contactUS.php.

Edit2:

Sorry, I forgot to mention that mod_rewrite applies rewrite rules to internal requests as well as client requests. So you need to add a rewrite condition to the redirect to prevent this:

RewriteRule ^contact-us$ contactUS.php [L]
RewriteCond %{ENV:REDIRECT_STATUS} !=200
RewriteRule ^contactUS.php$ contact-us [R=301]

10% popularity Vote Up Vote Down


Login to follow query

More posts by @Shanna517

0 Comments

Sorted by latest first Latest Oldest Best

Back to top | Use Dark Theme