Reply
Old 06-25-2009, 12:35 PM Question Mod_Rewrite help
Junior Talker

Posts: 1
Trades: 0
Hello, i'm having some problems with some mod_rewrite rules that maybe someone can help.

What I'm trying to acomplish is:

When trying to access:
www.example.com/fr/something
It should redirect to:
www.example.fr/fr/something

I have this is working with the following rules:
Code:
RewriteCond %{HTTP_HOST} ^www.example.com$
RewriteCond %{REQUEST_URI} /fr/
RewriteRule (.*) http://www.example.fr/$1 [R=301,L]
Now the problem is that I'm also trying to do the inverse, that is:

When trying to access:
www.example.fr/something
It should redirect to:
www.example.com/something

The rule that I have in place right now for this is:
Code:
RewriteCond %{HTTP_HOST} ^www.example.fr$
RewriteCond %{REQUEST_URI} !/fr/
RewriteRule (.*) http://www.example.com/$1 [R=301,L]
This is not working though.
With the second rewrite condition above I'm trying to say "when there isn't any country code subfolder it should redirect to the .com"



Any ideas anyone? I'm not too experienced with mod_rewrite or regular expressions so any feedback will be much appreciated.

Thanks.
rgomes1981 is offline
Reply With Quote
View Public Profile
 
 
When You Register, These Ads Go Away!
Old 06-28-2009, 12:47 PM Re: Mod_Rewrite help
Skilled Talker

Posts: 57
Name: Larry K
Trades: 0
In the first, successful, redirect, you are moving the contents of a French folder from a dot-com to a French domain.

In the second you want to redirect "something," apparently not everything from the French domain to the dot-com, but your RewriteCond is calling for the nonexistent /fr/ folder.
L a r r y is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Mod_Rewrite help
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 



Page generated in 0.14405 seconds with 13 queries