How can I express this nginx config as apache2 rewrite rules?
- by codecowboy
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.