Welcome! Log In Create A New Profile

Advanced

Rewrite external and internal on same link with SEO in mind

Posted by pchott 
Rewrite external and internal on same link with SEO in mind
September 02, 2014 02:22AM
Hi,

i have problems with preparing two rewrites since i fall to a loop when trying to solve if.

-->1. rewrite is external (301)

http://www.example.org/index.php?my_page --> http://www.example.org/my_page
http://www.example.org/index.php?p=my_page --> http://www.example.org/my_page

-->2. then execute actual php (internal)

http://www.example.org/my_page --> http://www.example.org/index.php?p=my_page

I have tried:

location ^~ /index.php {
if ($args = "my_page")
{
rewrite ^.*$ "http://www.example.org/my_page?" permanent;

}
}


rewrite ^/my_page$ /index.php?my_page last;

------
Internal works just fine, but with external i fall in inf loop.

What is real solution?????
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 170
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready