Welcome! Log In Create A New Profile

Advanced

Verifying the rewrite

Posted by hazenvnn 
Verifying the rewrite
March 31, 2011 11:28AM
I have a apache htaccess file as follow

RewriteEngine on

RewriteRule \.(css|jpe?g|gif|png|js|ico)$ - [L]

RewriteRule ^(admin|install).*$ - [L]

# Rewrite web pages to one master page
RewriteRule ^([^/\.]+)/?$ index.php?page=$1 [QSA,L]
RewriteRule ^([^/\.]+)/([^/]+)/?$ index.php?page=$1&id=$2 [QSA,L]
RewriteRule ^([^/\.]+)/([^/]+)/([^/]+)/? index.php?page=$1&id=$2&subpage=$3 [QSA,L]

I converted to

server {
rewrite /\.(css|jpe?g|gif|png|js|ico)$ last;
rewrite ^/(admin|install).*$ last;
rewrite ^/([^/\.]+)/?$ /index.php?page=$1 last;
rewrite ^/([^/\.]+)/([^/]+)/?$ /index.php?page=$1&id=$2 last;
rewrite ^/([^/\.]+)/([^/]+)/([^/]+)/? /index.php?page=$1&id=$2&subpage=$3 last;
}

Is it correct? I believe there is some problem as it is not working
Re: Verifying the rewrite
April 14, 2011 05:48AM
You may need to either set a proxy_pass or a root directive so nginx knows what to do with the rewritten urls.

Right now you most likely get a 404

e.g. add

location / {
root /var/www/yourdocroot/;
}

into your server block
Sorry, only registered users may post in this forum.

Click here to login

Online Users

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