index.php 301 redirect
Igor Sysoev
is at rambler-co.ru
Wed Oct 14 17:10:23 MSD 2009
On Wed, Oct 14, 2009 at 05:25:39AM -0700, SE7EN wrote:
> I want to redirect all calls to http://mydomain.com/index.php to http://mydomain.com to avoid duplicate pages.I use this
> if ($request_uri ~* "^/index.php\??$") {
> rewrite ^.*$ http://$host? permanent;
> }
>
> but it doesn't seem to work properly. Although it redirects I cannot login or logout anymore in Joomla, it simply redirect to homepage without login or logout. What am i missing here ? How do i do this properly ? Of course if i remove that everything i fine, it works for example for home.html but not for index.php.
> Thank you.
The right way is to use
location = /index.php {
rewrite ^ http://$host? permanent;
}
However, if you have the following configuration:
location / {
index index.php;
}
location = /index.php {
rewrite ^ http://$host? permanent;
}
then the "/" request will be internally redirected to "/index.php".
Therefore you should use something
location = /index.php {
if ($request_uri = /index.php) {
rewrite ^ http://$host? permanent;
}
...
}
How do login and logout URLs look ?
--
Igor Sysoev
http://sysoev.ru/en/
More information about the nginx
mailing list