How can I express this nginx config as apache2 rewrite rules?
Posted
by
codecowboy
on Server Fault
See other posts from Server Fault
or by codecowboy
Published on 2012-12-05T15:53:09Z
Indexed on
2012/12/05
17:06 UTC
Read the original article
Hit count: 463
if (!-e $request_filename){
rewrite /iOS/(.*jpg)$ /$1 last;
rewrite /iOS/(.*jpeg)$ /$1 last;
rewrite /iOS/(.*png)$ /$1 last;
rewrite /iOS/(.*css)$ /$1 last;
rewrite /iOS/(.*js)$ /$1 last;
rewrite /Android/(.*jpg)$ /$1 last;
rewrite /Android/(.*jpeg)$ /$1 last;
rewrite /Android/(.*png)$ /$1 last;
rewrite /Android/(.*css)$ /$1 last;
rewrite /Android/(.*js)$ /$1 last;
rewrite ^/(.*)$ /?route=$1 last;
}
There are some vanity URLs e.g. mysite.com/yourdetails which are handled internally by a router class (its a PHP app with index.php as the entry point) and they seem to work fine on nginx but not Apache :-/
I tried this but the vanity URLs are not working
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?route=$1 [L]
I'd like to rule out Apache config first before I get too deep into the code.
© Server Fault or respective owner