My developer has provided me some Apache rewrite rules that are required for our application to work. When I added them to Apache my http://www.domain.com/blog and http://www.domain.com/phpmyadmin pages no longer worked. I tried to add the first RewriteCond rule for my blog and also the final phpmyadmin rule but neither one is working as expected. Essentially I want any requests to /blog or /phpmyadmin to NOT rewrite and go to my document root directory and run those applications outside of rewrites. Can you help me figure out a solution? Thanks
RewriteCond %{REQUEST_URI} !^/blog/
RewriteRule ^/(.*_css.*\.css.*) /$1 [QSA,L]
RewriteRule ^/(.*_js.*\.js.*) /$1 [QSA,L]
RewriteRule ^/(.*_swf.*\.swf.*) /$1 [QSA,L]
RewriteRule ^/(.*_img.*\.[jpg|JPG|jpeg|JPEG|gif|GIF|bmp|BMP|png|PNG].*) /$1 [QSA,L]
RewriteRule ^/(.*)$ /index.php?url=$1 [QSA,L]
RewriteRule ^/phpmyadmin(.*)$ /phpmyadmin$1 [QSA,L]
</VirtualHost>
They are located at http://www.domain.com/blog and http://www.domain.com/phpmyadmin.
Apache 2.2.13
Thanks!
If you want to avoid rewriting URLs that begin with
/blog/or/phpmyadmin/then you may be able to get away with the first rule being:(replacing your
RewriteCondand then removing the old phpmyadmin rule).A quick explanation: this matches any URLs that begin with
/blog/or/phpmyadmin/and doesn’t rewrite them (-for the replacement), and then stops any further rewriting ([L]).Previous answer:
Your rewrite rules are conflicting, for a start. Also, at the moment, the RewriteCond only applies to the first rule. Also, the final rule is ignored because of the rule before it matching everything. You may want something like this:
as I assume you’re just trying to rewrite all URLs from
/blog/foo/barto/index.php?url=foo%2fbar? If not, please explain what you’re trying to accomplish and I’ll edit my answer.