Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

RewriteRule


Reply


4 Posts   1251 Views

Avatar
snaip

Community Member, 180 Posts

8 March 2009 at 5:02am

hi

i want to redirect the site to correct language version
how to modify the .htaccess ?

RewriteEngine On

RewriteBase /etravel

RewriteCond %{REQUEST_URI} !(\.gif)|(\.jpg)|(\.png)|(\.css)|(\.js)|(\.php)$
RewriteCond %{REQUEST_URI} ^(.*)$
RewriteCond %{REQUEST_FILENAME} !-f

RewriteRule .* sapphire/main.php?url=%1&%{QUERY_STRING} [L]

this doesn't work

RewriteCond %{HTTP:Accept-Language} (pl) [NC]
RewriteRule .* /etravel/wycieczki/ [R,L]

RewriteCond %{HTTP:Accept-Language} (en) [NC]
RewriteRule .* /etravel/tours/ [R,L]

RewriteCond %{HTTP:Accept-Language} (it) [NC]
RewriteRule .* /etravel/escursione/ [R,L]

Avatar
snaip

Community Member, 180 Posts

8 September 2009 at 1:22am

any idea ?

Avatar
banal

Community Member, 901 Posts

8 September 2009 at 2:13am

The [url=http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.4]Accept-Language[/url] header usually doesn't consist of a single language string like "en" or "pl".
You could try the following:

RewriteCond %{HTTP:Accept-Language} ^pl.*$ [NC]
RewriteRule .* /etravel/wycieczki/ [R=301,L]

But beware, every request with "Accept-Language = pl" will be redirected to /etravel/wycieczki/. So that basically limits you to 1 page per language... not sure if it's really that what you want

Avatar
snaip

Community Member, 180 Posts

8 September 2009 at 8:00am

Edited: 08/09/2009 8:12am

but the problem is hmm
the URL has been changed but i get blank page with 301 Error and message:

"Moved Permanently
The document has moved here." "here" is a link to new address but it doesnt work