Reputation: 91
Options -MultiViews
RewriteEngine On
RewriteBase /mvc/public
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]
location /mvc/public/ {
if (!-e $request_filename){
rewrite ^/mvc/public/(.+)$ /mvc/public/index.php?url=$1 [QSA,L];
}
}
But this did not work! Could someone help me?
Upvotes: 1
Views: 1420
Reputation: 49782
The [QSA,L]
is not nginx
syntax - see this document for details.
location /mvc/public/ {
if (!-e $request_filename) {
rewrite ^/mvc/public/(.+)$ /mvc/public/index.php?url=$1 last;
}
}
Similar behaviour can be accomplished with try_files
rather than the if
:
location /mvc/public/ {
try_files $uri $uri/ @rewrite;
}
location @rewrite {
rewrite ^/mvc/public/(.+)$ /mvc/public/index.php?url=$1 last;
}
See this document for details.
Upvotes: 2