Portal Home > Knowledgebase > Articles Database > lighttpd rewrite rule


lighttpd rewrite rule




Posted by sifro, 10-10-2009, 04:49 AM
Hello everybody, i have this rewrite rule that directs all the requests to the index.php page, provided that an exact match with a js,ico,gif,jpeg,png,css or php file is NOT found. url.rewrite-once = ( ".*\?(.*)$" => "/index.php?$1", ".*\.(js|ico|gif|jpg|png|css|php)$" => "$0", "" => "/index.php" ) The problem is: if i type in my address bar mysite.com/mypage.php, it works ok, but if i type mypage.php?someVar=someValue, it doesn't work anymore (index.php is called instead of mypage.php)... Can you help me to get it working? THanks!

Posted by AppKoders, 10-10-2009, 12:34 PM
why did you put this line ".*\?(.*)$" => "/index.php?$1", "" => "/index.php" by default index.php will be called already. this line triggers the rewrite ".*\?(.*)$" => "/index.php?$1", if you are trying to match a url like this domain.com/?querys=string then you should put a ^ in front of the \? or you can you try this instead url.rewrite-once = ( ".*\.(js|ico|gif|jpg|png|css|php)$" => "$0", "" => "/index.php" )

Posted by sifro, 10-10-2009, 03:18 PM
thank you, your post was really inspiring! bye



Was this answer helpful?

Add to Favourites Add to Favourites    Print this Article Print this Article

Also Read
help (Views: 795)
Liquidxhost review (Views: 797)


Language:

LoadingRetrieving latest tweet...

Back to Top Copyright © 2018 DC International LLC. - All Rights Reserved.