Jump to:

23486 Posts in 18995 Topics by 2878 members

General Questions

SilverStripe Forums » General Questions » RewriteRule

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

Page: 1
Go to End
Author Topic: 1201 Views
  • snaip
    Avatar
    Community Member
    180 Posts

    RewriteRule Link to this post

    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]

  • snaip
    Avatar
    Community Member
    180 Posts

    Re: RewriteRule Link to this post

    any idea ?

  • banal
    Avatar
    Community Member
    901 Posts

    Re: RewriteRule Link to this post

    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

  • snaip
    Avatar
    Community Member
    180 Posts

    Re: RewriteRule Link to this post

    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

    1201 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.