Welcome! Log In Create A New Profile

Advanced

NGINX URL MASKING

Posted by manojj 
NGINX URL MASKING
July 05, 2012 04:05AM
We have a server where nginx is installed, we have also configured PHP As FastCGI on the server. Everything is working fine except rewrite rule. Our requirement is to mask an URL

for eg:- if someone search in our website the URL which comes will be like http://example.com/search.php?searchword=$1 ($1=searched word) . We need to display URL for our customers as http://example.com/$1.html.

We have set rewrite rule as rewrite ^/(([a-zA-Z_0-9]|-)+/?)$ /search.php?searchword=$1 break;

The URL is getting redirected however we get a file not found error each time. How can we mask the URL just as we do in Apache. Any help would be greatly appreciated
Re: NGINX URL MASKING
July 05, 2012 04:14AM
Equivalent Apache htaccess rules which we used are as follows


RewriteCond %{REQUEST_URI} !index\.html$ [NC]
RewriteRule ^([a-zA-Z0-9-/]+).html$ search.php?searchword=$1 [L]
RewriteRule ^([a-zA-Z0-9-/]+).html/$ search.php?searchword=$1 [L]



It was working fine with Apache
Sorry, only registered users may post in this forum.

Click here to login

Online Users

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