Contact SalesSitemapCustomer Login

Go Back   VPSlink Forums > Technical Discussion > Development

Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 06-18-2009, 12:45 AM
Junior Member
 
Join Date: Jun 2009
Posts: 2
Default convert .htaccess file ( apache to lighttpd )

Hi,
How to convert this .htaccess file to lighttpd rewrite rule ?
Code:
DirectoryIndex index.php

RewriteEngine On

RewriteCond %{REQUEST_URI} ^/uploads/fotos/*.*
RewriteCond %{REQUEST_FILENAME} !-f
#RewriteRule ^.*$ /notfound [L,N]
RewriteRule ^.*$ /notfound [QSA,L,R=301]

RewriteRule ^page/(.*)$ index.php?cstart=$1 [L]


RewriteRule ^([0-9]{4})/([0-9]{2})/([0-9]{2})/page,([0-9]+),([0-9]+),(.*).html(/?)+$ index.php?subaction=showfull&year=$1&month=$2&day=$3&news_page=$4&cstart=$5&news_name=$6 [L]
RewriteRule ^([0-9]{4})/([0-9]{2})/([0-9]{2})/page,([0-9]+),(.*).html(/?)+$ index.php?subaction=showfull&year=$1&month=$2&day=$3&news_page=$4&news_name=$5 [L]
RewriteRule ^([0-9]{4})/([0-9]{2})/([0-9]{2})/print:page,([0-9]+),(.*).html(/?)+$ engine/print.php?subaction=showfull&year=$1&month=$2&day=$3&news_page=$4&news_name=$5 [L]
RewriteRule ^([0-9]{4})/([0-9]{2})/([0-9]{2})/(.*).html(/?)+$ index.php?subaction=showfull&year=$1&month=$2&day=$3&news_name=$4 [L]

RewriteRule ^([^.]+)/page,([0-9]+),([0-9]+),([0-9]+)-(.*).html(/?)+$ index.php?newsid=$4&news_page=$2&cstart=$3 [L]
RewriteRule ^([^.]+)/page,([0-9]+),([0-9]+)-(.*).html(/?)+$ index.php?newsid=$3&news_page=$2 [L]
RewriteRule ^([^.]+)/print:page,([0-9]+),([0-9]+)-(.*).html(/?)+$ engine/print.php?news_page=$2&newsid=$3 [L]
RewriteRule ^([^.]+)/([0-9]+)-(.*).html(/?)+$ index.php?newsid=$2 [L]

RewriteRule ^page,([0-9]+),([0-9]+),([0-9]+)-(.*).html(/?)+$ index.php?newsid=$3&news_page=$1&cstart=$2 [L]
RewriteRule ^page,([0-9]+),([0-9]+)-(.*).html(/?)+$ index.php?newsid=$2&news_page=$1 [L]
RewriteRule ^print:page,([0-9]+),([0-9]+)-(.*).html(/?)+$ engine/print.php?news_page=$1&newsid=$2 [L]
RewriteRule ^([0-9]+)-(.*).html(/?)+$ index.php?newsid=$1 [L]


RewriteRule ^([0-9]{4})/([0-9]{2})/([0-9]{2})(/?)+$ index.php?year=$1&month=$2&day=$3 [L]
RewriteRule ^([0-9]{4})/([0-9]{2})/([0-9]{2})/page/([0-9]+)(/?)+$ index.php?year=$1&month=$2&day=$3&cstart=$4 [L]

RewriteRule ^([0-9]{4})/([0-9]{2})(/?)+$ index.php?year=$1&month=$2 [L]
RewriteRule ^([0-9]{4})/([0-9]{2})/page/([0-9]+)(/?)+$ index.php?year=$1&month=$2&cstart=$3 [L]

RewriteRule ^([0-9]{4})(/?)+$ index.php?year=$1 [L]
RewriteRule ^([0-9]{4})/page/([0-9]+)(/?)+$ index.php?year=$1&cstart=$2 [L]

RewriteRule ^tags/([^/]*)(/?)+$ index.php?do=tags&tag=$1 [L]
RewriteRule ^tags/([^/]*)/page/([0-9]+)(/?)+$ index.php?do=tags&tag=$1&cstart=$2 [L]

RewriteRule ^user/([^/]*)/rss.xml$ engine/rss.php?subaction=allnews&user=$1 [L]
RewriteRule ^user/([^/]*)(/?)+$ index.php?subaction=userinfo&user=$1 [L]
RewriteRule ^user/([^/]*)/page/([0-9]+)(/?)+$ index.php?subaction=userinfo&user=$1&cstart=$2 [L]
RewriteRule ^user/([^/]*)/news(/?)+$ index.php?subaction=allnews&user=$1 [L]
RewriteRule ^user/([^/]*)/news/page/([0-9]+)(/?)+$ index.php?subaction=allnews&user=$1&cstart=$2 [L]
RewriteRule ^user/([^/]*)/news/rss.xml(/?)+$ engine/rss.php?subaction=allnews&user=$1 [L]

RewriteRule ^lastnews/(/?)+$ index.php?do=lastnews [L]
RewriteRule ^lastnews/page/([0-9]+)(/?)+$ index.php?do=lastnews&cstart=$1 [L]

RewriteRule ^catalog/([^/]*)(/?)+$ index.php?catalog=$1 [L]
RewriteRule ^catalog/([^/]*)/page/([0-9]+)(/?)+$ index.php?catalog=$1&cstart=$2 [L]

RewriteRule ^newposts(/?)+$ index.php?subaction=newposts [L]
RewriteRule ^newposts/page/([0-9]+)(/?)+$ index.php?subaction=newposts&cstart=$1 [L]

RewriteRule ^static/(.*).html(/?)+$ index.php?do=static&page=$1 [L]

RewriteRule ^favorites(/?)+$ index.php?do=favorites [L]
RewriteRule ^favorites/page/([0-9]+)(/?)+$ index.php?do=favorites&cstart=$1 [L]


RewriteRule ^rules.html$ index.php?do=rules [L]
RewriteRule ^dmca-policy.html$ dmca-policy.html [L]
RewriteRule ^statistics.html$ index.php?do=stats [L]
RewriteRule ^addnews.html$ index.php?do=addnews [L]
RewriteRule ^rss.xml$ engine/rss.php [L]
RewriteRule ^sitemap.xml$ sitemap.xml [L]
RewriteRule ^google9f559184ca0e96de.html$ google9f559184ca0e96de.html [L]

RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^.]+)/page/([0-9]+)(/?)+$ index.php?do=cat&category=$1&cstart=$2 [L]
RewriteCond %{REQUEST_URI} !^/notfound
RewriteRule ^([^.]+)/?$ index.php?do=cat&category=$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^<]+)/rss.xml$ engine/rss.php?do=cat&category=$1 [L]
RewriteRule ^page,([0-9]+),([^/]+).html$ index.php?do=static&page=$2&news_page=$1 [L]
RewriteRule ^print:([^/]+).html$ engine/print.php?do=static&page=$1 [L]
RewriteRule ^([^/]+)\.html$ index.php?do=static&page=$1 [L]
Would appreciate this very much, thanks in advance
Reply With Quote
  #2 (permalink)  
Old 06-18-2009, 10:22 PM
Administrator
 
Join Date: Dec 2007
Posts: 1,141
Default

I would recommend that you take a look at this thread which provides a basic guide to convert mod rewrite rule apache to lighttpd - if I were in your position, however, I would seriously consider getting rid of some of these rules before trying to duplicate them in lighttpd.

Rules like these are not effectively doing anything:

Code:
RewriteRule ^dmca-policy.html$ dmca-policy.html [L]
RewriteRule ^sitemap.xml$ sitemap.xml [L]
(Which would suggest that there may be other rules which either duplicate work or could be improved upon)
Reply With Quote
  #3 (permalink)  
Old 06-19-2009, 04:24 AM
Junior Member
 
Join Date: Jun 2009
Posts: 2
Default

Dear DanL@VPSLink,
Thanks for your respond. Yes, i read the above article too, but i don't understand anything. =(

Can you plz see the below codes & inform me it's correct or not?

Code:
"^page/(.*)$" => "/index.php?cstart=$1",
"^([0-9]{4})/([0-9]{2})/([0-9]{2})/page,([0-9]+),([0-9]+),(.*).html(/?)+$" => "/index.php?subaction=showfull&year=$1&month=$2&day=$3&news_page=$4&cstart=$5&news_name=$6",
"^([0-9]{4})/([0-9]{2})/([0-9]{2})/page,([0-9]+),(.*).html(/?)+$" => "/index.php?subaction=showfull&year=$1&month=$2&day=$3&news_page=$4&news_name=$5",
"^([0-9]{4})/([0-9]{2})/([0-9]{2})/print:page,([0-9]+),(.*).html(/?)+$" => "/engine/print.php?subaction=showfull&year=$1&month=$2&day=$3&news_page=$4&news_name=$5",
"^([0-9]{4})/([0-9]{2})/([0-9]{2})/(.*).html(/?)+$" => "/index.php?subaction=showfull&year=$1&month=$2&day=$3&news_name=$4",
"^([^.]+)/page,([0-9]+),([0-9]+),([0-9]+)-(.*).html(/?)+$" => "/index.php?newsid=$4&news_page=$2&cstart=$3",
"^([^.]+)/page,([0-9]+),([0-9]+)-(.*).html(/?)+$" => "/index.php?newsid=$3&news_page=$2",
"^([^.]+)/print:page,([0-9]+),([0-9]+)-(.*).html(/?)+$" => "/engine/print.php?news_page=$2&newsid=$3",
"^([^.]+)/([0-9]+)-(.*).html(/?)+$" => "/index.php?newsid=$2",
"^page,([0-9]+),([0-9]+),([0-9]+)-(.*).html(/?)+$" => "/index.php?newsid=$3&news_page=$1&cstart=$2",
"^page,([0-9]+),([0-9]+)-(.*).html(/?)+$" => "/index.php?newsid=$2&news_page=$1",
"^print:page,([0-9]+),([0-9]+)-(.*).html(/?)+$" => "/engine/print.php?news_page=$1&newsid=$2",
"^([0-9]+)-(.*).html(/?)+$" => "/index.php?newsid=$1",
"^([0-9]{4})/([0-9]{2})/([0-9]{2})(/?)+$" => "/index.php?year=$1&month=$2&day=$3",
"^([0-9]{4})/([0-9]{2})/([0-9]{2})/page/([0-9]+)(/?)+$" => "/index.php?year=$1&month=$2&day=$3&cstart=$4",
"^([0-9]{4})/([0-9]{2})(/?)+$" => "/index.php?year=$1&month=$2",
"^([0-9]{4})/([0-9]{2})/page/([0-9]+)(/?)+$" => "/index.php?year=$1&month=$2&cstart=$3",
"^([0-9]{4})(/?)+$" => "/index.php?year=$1",
"^([0-9]{4})/page/([0-9]+)(/?)+$" => "/index.php?year=$1&cstart=$2",
"^tags/([^/]*)(/?)+$" => "/index.php?do=tags&tag=$1",
"^tags/([^/]*)/page/([0-9]+)(/?)+$" => "/index.php?do=tags&tag=$1&cstart=$2",
"^user/([^/]*)/rss.xml$" => "/engine/rss.php?subaction=allnews&user=$1",
"^user/([^/]*)(/?)+$" => "/index.php?subaction=userinfo&user=$1",
"^user/([^/]*)/page/([0-9]+)(/?)+$" => "/index.php?subaction=userinfo&user=$1&cstart=$2",
"^user/([^/]*)/news(/?)+$" => "/index.php?subaction=allnews&user=$1",
"^user/([^/]*)/news/page/([0-9]+)(/?)+$" => "/index.php?subaction=allnews&user=$1&cstart=$2",
"^user/([^/]*)/news/rss.xml(/?)+$" => "/engine/rss.php?subaction=allnews&user=$1",
"^lastnews/(/?)+$" => "/index.php?do=lastnews",
"^lastnews/page/([0-9]+)(/?)+$" => "/index.php?do=lastnews&cstart=$1",
"^catalog/([^/]*)(/?)+$" => "/index.php?catalog=$1",
"^catalog/([^/]*)/page/([0-9]+)(/?)+$" => "/index.php?catalog=$1&cstart=$2",
"^newposts(/?)+$" => "/index.php?subaction=newposts",
"^newposts/page/([0-9]+)(/?)+$" => "/index.php?subaction=newposts&cstart=$1",
"^static/(.*).html(/?)+$" => "/index.php?do=static&page=$1",
"^favorites(/?)+$" => "/index.php?do=favorites",
"^favorites/page/([0-9]+)(/?)+$" => "/index.php?do=favorites&cstart=$1",
"^rules.html$" => "/index.php?do=rules",
"^dmca-policy.html$" => "/dmca-policy.html",
"^statistics.html$" => "/index.php?do=stats",
"^addnews.html$" => "/index.php?do=addnews",
"^rss.xml$" => "/engine/rss.php",
"^sitemap.xml$" => "/sitemap.xml",
"^google9f559184ca0e96de.html$" => "/google9f559184ca0e96de.html",
"%{REQUEST_FILENAME}" => "/!-d",
"^([^.]+)/page/([0-9]+)(/?)+$" => "/index.php?do=cat&category=$1&cstart=$2",
"%{REQUEST_URI}" => "/!^/notfound",
"^([^.]+)/?$" => "/index.php?do=cat&category=$1",
"%{REQUEST_FILENAME}" => "/!-f",
"^([^<]+)/rss.xml$" => "/engine/rss.php?do=cat&category=$1",
"^page,([0-9]+),([^/]+).html$" => "/index.php?do=static&page=$2&news_page=$1",
"^print[^/]+).html$" => "/engine/print.php?do=static&page=$1",
"^([^/]+)\.html$" => "/index.php?do=static&page=$1",
Reply With Quote
  #4 (permalink)  
Old 06-19-2009, 06:46 PM
Administrator
 
Join Date: Dec 2007
Posts: 1,141
Default

VPSLink's service is unmanaged - we do not provide application-level support and as much as I or our technicians would like to help, the task which you've presented would probably take a great deal of time to complete correctly and none of our staff are being paid to provide this type of support.

My best recommendation would be that you review the lighttpd mod_rewrite documentation and visit the lighttpd Support Forums if you have questions specific to lighttpd which are not being answered to your satisfaction here on the VPSLink forums.
Reply With Quote
  #5 (permalink)  
Old 06-22-2009, 12:52 AM
Senior Member
 
Join Date: Jul 2007
Location: 127.0.0.1
Posts: 391
Default

Quote:
Originally Posted by hrdn View Post
Can you plz see the below codes & inform me it's correct or not?
The best way to determine this is to commit the changes and test for yourself. Use the docs DanL linked to if you run into any issues.
Reply With Quote
Reply

Bookmarks

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:30 PM.


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