Migration from apache, rewrite problem

#1
Hello,

I am moving a script from apache and having problems with rewrite.
These are the rules added from the LS panel:

RewriteRule ^img-(.*)\.html img.php?id=$1 [L]
RewriteRule ^slide-(.*)\.html slider.php?id=$1 [L]
RewriteRule ^page-(.*)\.html page.php?name=$1 [L]
RewriteRule ^contact\.html$ contact.php [QSA,L,NC]

This is from the log:

2013-11-13 03:41:35.794 INFO [ip:60723] [REWRITE] Rule: Match '/img-526825975586d.html' with pattern '^img-(.*)\.html', result: -1
2013-11-13 03:41:35.794 INFO [ip:60723] [REWRITE] Rule: Match '/img-526825975586d.html' with pattern '^slide-(.*)\.html', result: -1
2013-11-13 03:41:35.794 INFO [ip:60723] [REWRITE] Rule: Match '/img-526825975586d.html' with pattern '^page-(.*)\.html', result: -1
2013-11-13 03:41:35.794 INFO [ip:60723] [REWRITE] Rule: Match '/img-526825975586d.html' with pattern '^contact\.html$', result: -1

Not sure what result -1 means, didn't find anything on the forum...

Thank you
 

NiteWave

Administrator
#2
actually there are 2 formats of rewrite rules: per-server and per-directory.

the example you give is per-directory format, should put into a .htaccess file
not into "the LS panel" which is per-server format.
 
#3
Hello,

I removed the rules from the panel and added them into .htaccess from the root folder of the script but the pages are still not working and there is nothing new in the error log.

Is there a special configuration somewhere to enable the use of .htaccess or am I missing something ?
 

mistwang

LiteSpeed Staff
#4
You current setup may not have .htaccess enabled, so those rules wont work in .htaccess.
If you use pure LiteSpeed setup, not using Apache configuration, you can convert the rewrite to a vhost level rewrite rule. htaccess support can be disabled to get better performance. Just add "/?" to your current rule.

RewriteRule ^/?img-(.*)\.html img.php?id=$1 [L]
RewriteRule ^/?slide-(.*)\.html slider.php?id=$1 [L]
RewriteRule ^/?page-(.*)\.html page.php?name=$1 [L]
RewriteRule ^/?contact\.html$ contact.php [QSA,L,NC]
 
Top