Contact SalesSitemapCustomer Login

Go Back   VPSlink Forums > Technical Discussion > Development

Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 02-13-2009, 06:49 AM
Junior Member
 
Join Date: Feb 2009
Posts: 27
Question convert mod rewrite rule apache to lighttpd

Hi,

please reply this,

How to convert this .htaccess file to lighttpd rewrite rule


RewriteRule ^(css|js|grafika|sample_photos|avatars25|avatars_m ini|avatars_group|resources|ajax|colourmod|rss|bac kgrounds|bglib|adminlogin|vision|post_img|logo|db_ backup) - [L]
RewriteRule ^api\/ - [L]
RewriteRule ^(logout.php|randompic.php|sticker_data.php|my_sta tus.php|sticker.swf|delete_me.php|get_sms.php) - [L]
RewriteRule ^[^/].*$ index.php

Thanks.
Reply With Quote
  #2 (permalink)  
Old 02-13-2009, 11:28 PM
Administrator
 
Join Date: Dec 2007
Posts: 1,123
Default

From the lighttpd mod_rewrite documentation:

Quote:
url.rewrite-once - Rewrites a set of URLs internally in the webserver BEFORE they are handled
Code:
url.rewrite-once = ( "<regex>" => "<relative-uri>" )
url.rewrite-repeat - Rewrites a set of URLs internally in the webserver BEFORE they are handled
Code:
url.rewrite-repeat = ( "<regex>" => "<relative-uri>" )
The difference between these options is that, while url.rewrite-repeat allows for applying multiple (seperately defined) rewrite rules in a row, url.rewrite-once will cause further rewrite rules to be skipped if the expression was matched. As such, url.rewrite-once behaves like Apaches' RewriteRule ... [L]
Your first three RewriteRule directives appear to be set to prevent rewrite substitution for the paths listed, so you may want to use a negative match operator to redirect everything except the URI's which match to your index.php file.
Reply With Quote
  #3 (permalink)  
Old 02-17-2009, 07:10 PM
Administrator
 
Join Date: Dec 2007
Posts: 1,123
Default

Negative match example:

Code:
url.rewrite-once = ( "^(/(?!(css|js)).*)" => "/index.php" )
Reply With Quote
  #4 (permalink)  
Old 02-25-2009, 02:20 PM
Junior Member
 
Join Date: Feb 2009
Posts: 27
Default

Hi,

this rule ok thank you

url.rewrite-once = ( "^(/(?!(css|js)).*)" => "/index.php" )


i create another rule

url.rewrite-once = ( "^(/(?!(/mitdev/revou/(css|js))).*)" => "/mitdev/revou/index.php" )

But this is not working. i have no idea???/
Reply With Quote
  #5 (permalink)  
Old 02-25-2009, 09:08 PM
Administrator
 
Join Date: Dec 2007
Posts: 1,123
Default

Give this one a try:

Code:
url.rewrite-once = (
  "(.*)(/(?!.*\.(css|js)$))" => "$1/index.php"
)
This pattern should work by negative-matching files which end in .css or .js
Reply With Quote
  #6 (permalink)  
Old 03-01-2009, 03:12 PM
Junior Member
 
Join Date: Feb 2009
Posts: 27
Default

hi,

i want negative match using directory

i use given code
url.rewrite-once = ( "^(/(?!(/mitdev/revou/(adminlogin|grafika))).*)" => "/mitdev/revou/index.php" ).

But this is not working.

I want Negative match using dirctory.
Reply With Quote
  #7 (permalink)  
Old 03-02-2009, 08:31 PM
Administrator
 
Join Date: Dec 2007
Posts: 1,123
Default

In that case, your rule would look more like this:

Code:
url.rewrite-once = (
  "(.*)(/(?!.*(directory\/|subdirectory\/)$))" => "$1/index.html"
)
There should not be any need to use the form "/mitdev/revou/" - simply matching the ending directory will do the trick.

To make your rules as easy as possible to manage in the future (or to assist with automated rule generation), you may want to add rules in the following manner:

Code:
url.rewrite-once = (
  "(.*)(/(?!.*(directory\/)$))" => "$1/index.html",
  "(.*)(/(?!.*(subdirectory\/)$))" => "$1/index.html"
)
Reply With Quote
Reply

Bookmarks

Tags
lighttpd, modrewrite, rewriterul

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



All times are GMT. The time now is 03:13 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.2.0