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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

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

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

RewriteRule


Go to End


4 Posts   1648 Views

Avatar
snaip

Community Member, 181 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, 181 Posts

8 September 2009 at 1:22am

any idea ?

Avatar
bummzack

Community Member, 904 Posts

8 September 2009 at 2:13am

The Accept-Language 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, 181 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