url rewriting - Converting mod_rewrite rules in .htaccess to httpd.conf -


i have set of html files at: www.example.com , "main site" (in beta) at: www.example.com/abcd/ (for these mod_rewrite rules needed)

the mod_rewrite rules run fine in directory within .htaccess. need put them in httpd.conf:

the rules in .htaccess:

rewriteengine on rewritebase /abcd/  rewriterule ^.*/codelibrary/(.*)$ codelibrary/$1 [l] rewriterule ^.*/in_upload/images/(.*)$ in_upload/images/$1 [l] ... 

copying below httpd.conf file didnt work:

<virtualhost *:80>  serveralias   www.example.com  serveradmin   nobody@example.com  documentroot /var/www/html  serversignature on   <ifmodule mod_rewrite.c>     rewriteengine on     rewritebase /abcd/     ... 

it gave error:

rewritebase: valid in per-directory config files 

do need modify rules this?

rewriterule ^.*/abcd/codelibrary/(.*)$ abcd/codelibrary/$1 [l] rewriterule ^.*/abcd/in_upload/images/(.*)$ abcd/in_upload/images/$1 [l] 

edit1

i tried convert following lines from:

... rewriterule (.*)ins.html$ browse.php?type=ins [l] ... rewriterule ^([a-za-z\-]*)/([a-za-z0-9\s]*)/([0-9]*)\.html$ browse.php?type=$1&catid=$3 [l] rewriterule ^([a-za-z\-]*)/([a-za-z0-9\s]*)/([a-za-z0-9\s]*)/([0-9]*)/([0-9]*)\.html$ browse.php?type=$1&catid=$4&subcatid=$5 [l] ... 

to:

... rewriterule ^/abcd/ins.html$ abcd/browse.php?type=ins [l] ... rewriterule ^/abcd/([a-za-z\-]*)/([a-za-z0-9\-\s]*)/([0-9]*)\.html$ abcd/browse.php?type=$1&catid=$3 [l] rewriterule ^/abcd/([a-za-z\-]*)/([a-za-z0-9\-\s]*)/([a-za-z0-9\-\s]*)/([0-9]*)/([0-9]*)\.html$ abcd/browse.php?type=$1&catid=$4&subcatid=$5 [l] ... 

but got errors follows.

when try accessing http://www.example.com/abcd/ins/sustainability/282.html , following error in log:

ipaddress - - [datetime] [www.example.com/sid#2b3cde3c1be0][rid#2b3cec076e70/initial] (2) init rewrite engine requested uri /abcd/ins/sustainability/282.html ipaddress - - [datetime] [www.example.com/sid#2b3cde3c1be0][rid#2b3cec076e70/initial] (2) rewrite '/abcd/ins/sustainability/282.html' -> 'abcd/browse.php?type=ins&catid=282' ipaddress - - [datetime] [www.example.com/sid#2b3cde3c1be0][rid#2b3cec076e70/initial] (2) local path result: abcd/browse.php 

when try accessing http://www.example.com/abcd/ins.html , following error in log:

ipaddress - - [datetime] [www.example.com/sid#2b3cde3c1be0][rid#2b3cec076e70/initial] (2) init rewrite engine requested uri /abcd/ins.html ipaddress - - [datetime] [www.example.com/sid#2b3cde3c1be0][rid#2b3cec076e70/initial] (2) rewrite '/abcd/ins.html' -> 'abcd/browse.php?type=ins' ipaddress - - [datetime] [www.example.com/sid#2b3cde3c1be0][rid#2b3cec076e70/initial] (2) local path result: abcd/browse.php 

i've set rewriteloglevel 2

the unmodified version of our mod_rewrite rules at: https://webmasters.stackexchange.com/questions/4237/url-rewritten-pages-take-much-longer-to-load

what purpose of rewrite rules (i.e trying achieve)?

by looks of original in .htaccess doing redirect: www.example.com/abcd/anything/codelibrary/aaaa www.example.com/abcd/codelibrary/aaaa

same in_upload/images too, correct?

if should work:

rewriterule ^/abcd/.*/codelibrary/(.*)$ /abcd/codelibrary/$1 [l] rewriterule ^/abcd/.*/in_upload/images/(.*)$ /abcd/in_upload/images/$1 [l] 

Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -