New on LowEndTalk? Please Register and read our Community Rules.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
Need help with Apache to Nginx Rewrite Rules
I have an apache .htaccess that I need to convert to Nginx in order to run on my LEB.
RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule .* index.php?/$0 [PT,L]
I followed some converters online and it gave me this
# nginx configuration location / { if (!-e $request_filename){ rewrite ^(.*)$ /index.php?/$0 break; } }
However, nginx won't start and is complaining about
nginx: [emerg] unknown "0" variable
Any help would be greatly appreciated!
Comments
How about just this?
That was the default in my Tuxlite nginx config and it didn't work.
if nginx
http://wiki.nginx.org/IfIsEvil
maybe, not sure lol
try_files $uri $uri/ /index.php?/$args;
I haven't tested this, but rewrite doc examples use $1 (and not $0) for substitution. Hence that error.
REF: http://nginx.org/en/docs/http/converting_rewrite_rules.html
Why are you OPs always being "soooooooo" helpful with providing us more information? I'd really like to know for which software you need the rewrite rules for. That might help more than you think.
You can always try few online tools: http://bit.ly/1qY9WdJ
Looks like WP.
It is a social app built on top of codeigniter that utilizes rewrite for seo friendly images and links. I decided to just fork over some more money to get a LEB with higher ram so I can host it on apache instead to avoid this and potential problems down the road. Thank you everyone for all their help.
NGINX might provide more scalability for this type of application. On their Wiki, they've published correct configuration files for CodeIgniter.
I know you've switched, but for future reference NGINX is easier to configure than Apache.
http://wiki.nginx.org/Codeigniter