1

I'm in the process of converting an application from Unix to a Windows based infrastructure, one of the changes being made is utilizing apache instead of lighttpd for the web server. Most of this conversion has been straight forward, however I'm having problems converting the rewrite logic over to the new server. After spending a day trying various configurations, I'm not having any success. Either no URLs are rewritten, or ALL of them are - neither scenario is valid. Here are the lighttpd rules:

"^/$" => "/apex/f?p=314:1::::::",
"^/(view)/(\d{10,16})/(\d{1,10})/" => "/apex/f?p=314:ticket:$2::NO::P3_TICKET:$3",
"^/(estimate)/(\d{10,16})/(\d{1,10})/" => "/apex/f?p=314:estimate:$2::NO::P6_TICKET:$3",
"^/([A-Za-z0-9_-]*)/(\d{10,16})/$" => "/apex/f?p=314:$1:$2::NO:::",
"^/([A-Za-z0-9_-]*)/(\d{10,16})/f" => "/apex/f?p=314:$1:$2::NO:::",
"^/authenticate/(\d{10,16})/(.*)/$" => "/apex/f?p=314:authenticate:$1::NO::UN,HMAC,TS:$2",
"^/authenticate/(\d{10,16})/(.*)/wwv_flow.accept$" => "/apex/wwv_flow.accept",
"^/admin/$" => "/apex/f?p=4550:::::::"

And this is what I have tried thus far in my .htaccess:

RewriteEngine On
RewriteRule ^/(view)/(\d{10,16})/(\d{1,10})/ /apex/f?p=314:ticket:$2::NO::P3_TICKET:$3 [QSA,L]
RewriteRule ^/(estimate)/(\d{10,16})/(\d{1,10})/ /apex/f?p=314:estimate:$2::NO::P6_TICKET:$3 [QSA,L]
RewriteRule ^/([A-Za-z0-9_-]*)/(\d{10,16})/$ /apex/f?p=314:$1:$2::NO::: [QSA,L]
RewriteRule ^/([A-Za-z0-9_-]*)/(\d{10,16})/f /apex/f?p=314:$1:$2::NO::: [QSA,L]
RewriteRule ^/authenticate/(\d{10,16})/(.*)/$ /apex/f?p=314:authenticate:$1::NO::UN,HMAC,TS:$2 [QSA,L]
RewriteRule ^/authenticate/(\d{10,16})/(.*)/wwv_flow.accept$ /apex/wwv_flow.accept [QSA,L]
RewriteRule ^/admin/$ /apex/f?p=4550 [QSA,L]
RewriteRule ^/$ /apex/f?p=314:1:::::: [QSA,L]

Currently, this is resulting in all URLs attempting to be rewritten. This breaks most of the site as a large majority of the site is not hidden behind rewrite rules/logic.

What am I doing wrong here? The apache documentation is not as clear (to me) as the lighttpd documentation, so I'm having difficulty seeing what's wrong.

rage8885
  • 393
  • 1
  • 3
  • 6
  • Off-topic, but you shouldn't use .htaccess as it's a performance disaster. Instead, include your configuration directly in Apache's configuration file and make sure to put "AllowOverride None" so Apache doesn't waste resources looking for htaccess files recursively in all directories. – André Borie Oct 06 '15 at 00:53

0 Answers0