Internet Marketing Forum

Internet Marketing Forum


For Webmasters and Entrepreneurs
|
Welcome, Guest. Please login or register.
Did you miss your activation email?
May 17, 2012, 12:55:55 PM

Login with username, password and session length

Men take only their needs into consideration, never their abilities.


- Napoleon Bonaparte

|-   Internet Marketing Forum > Online Business Discussions > Website Design and Maintenance > Administration
+  

RewriteRule help

0 Members and 1 Guest are viewing this topic.
Pages: [1] Reply to Thread
Author Topic: RewriteRule help  (Read 900 times)
OfflinePPablo
Beginner
PPablo is on a distinguished road
Joined: Jan 2008
Posts: 26


anonymous avatar

View PPablo\s Profile
Poland
notepad Jul 16, 2008, 09:05:14 PM #1
Using RewriteCond/RewriteRule, I'm trying to redirect all requests (except /index.html) aiming to my root directory to the default /fr directory.

It does not seem to work...

Here is my code:

RewriteEngine on
RewriteCond %(REQUEST_URI) !/index\.html
RewriteRule ^/(.*)$ /fr/$1 [R=301,L]

What's wrong with it?


OfflineAceCoder
Junior Member
AceCoder is on a distinguished road
Joined: Oct 2007
Posts: 79



View AceCoder\s ProfileWWW
United States
notepad Aug 02, 2008, 10:52:55 AM #2
Quote from: PPablo on Jul 16, 2008, 09:05:14 PM
Using RewriteCond/RewriteRule, I'm trying to redirect all requests (except /index.html) aiming to my root directory to the default /fr directory.

It does not seem to work...

Here is my code:

RewriteEngine on
RewriteCond %(REQUEST_URI) !/index\.html
RewriteRule ^/(.*)$ /fr/$1 [R=301,L]

What's wrong with it?



You don't need the forward slash in the RewriteRule and you should set a RewriteBase. It should look like this

RewriteEngine on

RewriteBase /
RewriteCond %(REQUEST_URI) ^index\.html
RewriteRule ^/(.*)$ /fr/$1 [R=301,L]

Latest Blog Post : PHP – Pass by Reference or Pass by Value

Summer Savings! $7.49 .com domains at GoDaddy.com!
Pages: [1] Reply to Thread


Code4Gold Internet Marketing Forum © 2006-2011 Resdaz Media LLC - All Rights Reserved
Forum Software Powered by SMF - © 2001-2008, Lewis Media. All Rights Reserved.