Thursday, 15 August 2013

.htaccess - RewriteRule working both online and on a local subfolder -



.htaccess - RewriteRule working both online and on a local subfolder -

i have problem , i'm sure there much solutions here can't find search find it...

i'm working on website, , sometime prefer work on local version. assuming :

http://www.normal-website.com http://127.0.0.1/local-version/

for each version have different rule rewrite css/style.css css/style.css.php (my htaccess in root folder) :

rewriterule ^css/([a-z0-9-/]+).css$ css/$1.css.php [qsa,l] rewriterule ^css/([a-z0-9-/]+).css$ local-version/css/$1.css.php [qsa,l]

how ca write have 1 rule, can have same htaccess online , locally ? possible dir (like if work on version 127.0.0.1/website2/ example) ?

thanks lot help, sorry repost if can find existing reply me.

you can use:

rewriteengine on rewritecond %{request_uri}::$1 ^(.*?/)(.*)::\2$ rewriterule ^(.*)$ - [e=base:%1] rewriterule ^css/([a-z0-9/-]+)\.css$ %{env:base}css/$1.css.php [nc,l]

.htaccess mod-rewrite

No comments:

Post a Comment