Welcome! Log In Create A New Profile

Advanced

Rewrite Map not working or bring triggered

Posted by Dannymh 
Rewrite Map not working or bring triggered
January 07, 2015 05:59PM
Hi,

I am currently moving from an apache setup and have tried to do a mass of rewrites. I am worried about issues with a regex interrupting my new URL scheme, so in the process of the move from server to server and new software, I write out a reference of all of the 4000 articles with links to their new articles.

However I can not get the map to pick up. The ID actually changes between the new setup though which is why I generate the map file and reference database table

THe old URL looks like

http://mysite.com/123456/article-title

and the new URL is
http://mysite.com/threads/article-title.656565

So my map file looks like

location / {
include /usr/local/etc/nginx/conf.d/php-fpm;
include /usr/local/etc/nginx/rewrite_rules_x.map;
fastcgi_buffer_size 128k;
fastcgi_buffers 4 256k;
fastcgi_busy_buffers_size 256k;
index index.php index.html index.htm;
try_files $uri $uri/ /silverforo/index.php?$uri&$args;
}

rewrite /123455/article-title /threads/atrticle-title.656565/ permanent;

I then include that within my location directive

This just doesnt get picked up at all and it just launches my error page of the app.

I have tried a few variations of this with no luck as well. I also tried direct redirects and no luck.

I could possibly do a redirect with an intermediary file that takes the ID from the URL and then queries the database to get the new URL and does a http 301 redirect.
However I just cant get that working either!

Any chance anyone has any ideas?

cheers
Dan
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 311
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