Hello,
I have tryed to read about rewrite rules but I’m not able to handle
this, Have already tryed online convert for .htaccess to nginx but when
I restart my ngnix server I get error message
[emerg]: invalid parameter "/[L]" in /usr/local/nginx/conf/rrulesvco:24
configuration file /usr/local/nginx/conf/nginx.conf test failed
/usr/local/nginx/conf/rrulesvco is include in my nginx.conf file under
my "location ~ .php$ { "
My old .htaccess looks like so:
RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]
RewriteCond %{QUERY_STRING} base64_encode.*\(.*\) [OR]
RewriteCond %{QUERY_STRING} (\<|%3C).*script.*(\>|%3E) [NC,OR]
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
RewriteRule ^([^.]*)/?$ index.php [L]
RewriteRule ^videos/(.*)/(.*)/(.*)/(.*)/(.*)
videos.php?cat=$1&sort=$3&time=$4&page=$5&seo_cat_name=$2 [L]
RewriteRule ^videos videos.php?%{QUERY_STRING} [L]
RewriteRule ^video/(.*)/(.*) watch_video.php?v=$1&%{QUERY_STRING} [L]
RewriteRule ^channels/(.*)/(.*)/(.*)/(.*)/(.*)
channels.php?cat=$1&sort=$3&time=$4&page=$5&seo_cat_name=$2 [L]
RewriteRule ^channels channels.php [L]
RewriteRule
^group/([a-zA-Z0-9].+) view_group.php?url=$1&%{QUERY_STRING}
[L]
RewriteRule
^view_topic/([a-zA-Z0-9].+)_tid_([0-9]+)
view_topic.php?tid=$2&%{QUERY_STRING}
[L]
RewriteRule ^groups/(.*)/(.*)/(.*)/(.*)/(.*)
groups.php?cat=$1&sort=$3&time=$4&page=$5&seo_cat_name=$2 [L]
RewriteRule ^groups groups.php [L]
RewriteRule ^create_group create_group.php [L]
RewriteRule ^sitemap.xml$ sitemap.php
RewriteRule ^signup signup.php
RewriteRule ^rss$ rss.php [nc]
RewriteRule ^rss/([a-zA-Z0-9].+)$
rss.php?mode=$1&%{QUERY_STRING} [nc]
RewriteRule ^desktop desktop.php [L]
Thanks
Posted at Nginx Forum:
Hello, I have tryed to read about rewrite rules but I'm not able to handle this, Have already tryed online convert for .htaccess to nginx but when I restart my ngnix server I get error message [code] [emerg]: invalid parameter "/[L]" in...
tophi
February 8, 2011, 5:18pm
2
Thanks! It works on 100% now !
Posted at Nginx Forum:
Hello, I have tryed to read about rewrite rules but I'm not able to handle this, Have already tryed online convert for .htaccess to nginx but when I restart my ngnix server I get error message [code] [emerg]: invalid parameter "/[L]" in...
tophi
October 12, 2011, 11:52am
3
i search on google and found this thread… if still consufed i found 1
link usefull to convert htaccess to nginx
cekidot bekicot
http://www.anilcetin.com/convert-apache-htaccess-to-nginx/
Posted at Nginx Forum:
Hello, I have tryed to read about rewrite rules but I'm not able to handle this, Have already tryed online convert for .htaccess to nginx but when I restart my ngnix server I get error message [code] [emerg]: invalid parameter "/[L]" in...
tophi
February 6, 2011, 8:37pm
4
On 6 Fev 2011 19h10 WET, [email protected] wrote:
RewriteRule ^videos videos.php?%{QUERY_STRING} [L] RewriteRule
create_group.php [L] RewriteRule ^sitemap.xml$ sitemap.php
RewriteRule ^signup signup.php RewriteRule ^rss$ rss.php [nc]
RewriteRule ^rss/([a-zA-Z0-9].+)$ rss.php?mode=$1&%{QUERY_STRING}
[nc] RewriteRule ^desktop desktop.php [L]
Have read the documentation at the wiki?
http://wiki.nginx.org/HttpRewriteModule
Is shock full of examples.
Bear in mind that:
There’s no RewriteCond equivalent in Nginx. Instead you match a
given location and the rewrite happens there.
Apart from the fact that Apache uses a more verbose syntax the
Rewrite rule can be sort of copied from Apache to Nginx.
Flags, Apache - Nginx equivalence:
L - last
R=301 - permanent
R=302 or simply R - redirect
Here’s an example from your Apache rewrites:
Without condition:
RewriteRule ^channels/(.)/(. )/(.)/(. )/(.*)
channels.php?cat=$1&sort=$3&time=$4&page=$5&seo_cat_name=$2 [L]
rewrite ^channels/(.)/(. )/(.)/(. )/(.*)
channels.php?cat=$1&sort=$3&time=$4&page=$5&seo_cat_name=$2 last;
With a condition:
if ($query_string ~ “base64_encode.(. )”) {
rewrite ^(?:[^.]*)/?$ index.php last;
}
Now you just have to do it for every other condition and rule in your
Apache config.
— appa