Help to write ReWrite Rule

Problems with the Linux version of XAMPP, questions, comments, and anything related.

Help to write ReWrite Rule

Postby jponnusamy » 31. May 2016 08:19

Dear All,
I am new to Apache, We have requirement to hide subfolder from User perspective like below:

Code: Select all
Existing URL: http://cmspweb1.com/sites/fr_CA/xxxx
Expecting URL: http://cmspweb1.com/sites/fr/xxxx


We dont have any folder called fr, So If I use below rewrite rule, its replacing fr_CA with fr, but getting 404 Error. Kindly please let me know if I missed anything.

Code: Select all
RewriteRule ^/sites/fr_CA/(.*) http://cmspweb1.com/sites/fr/$1




I tried Lot but nothing is working. Kindly please help me on this
Thanks
Jay
jponnusamy
 
Posts: 6
Joined: 31. May 2016 08:06
XAMPP version: 2.3
Operating System: Redhat 6

Re: Help to write ReWrite Rule

Postby Nobbie » 31. May 2016 18:49

jponnusamy wrote:We dont have any folder called fr, So If I use below rewrite rule, its replacing fr_CA with fr, but getting 404 Error.


Of course, because you are doing it just in the wrong direction. You have to replace "fr" by "fr_CA", and not "fr_CA" by "fr".
Nobbie
 
Posts: 13183
Joined: 09. March 2008 13:04

Re: Help to write ReWrite Rule

Postby jponnusamy » 02. June 2016 12:33

Dear Nobbie,
Thanks for the reply.
Actually we dont have any folder called fr and we have only fr_CA, but we dont want to show fr_CA to client browser. and want to show fr instead of fr_CA only on browser. Mean fr should show fr_CA's contents.
Thanks
Jayaram
jponnusamy
 
Posts: 6
Joined: 31. May 2016 08:06
XAMPP version: 2.3
Operating System: Redhat 6


Return to XAMPP for Linux

Who is online

Users browsing this forum: No registered users and 15 guests