Need help with Apache Rewrite issues

My developer provided me with some Apache rewrite rules necessary for our application to work. When I added them to Apache, my pages www.domain.com/blog and www.domain.com/phpmyadmin no longer worked. I tried to add the first RewriteCond rule for my blog, as well as the last phpmyadmin rule, but no one is working properly. Essentially, I want any / blog or / phpmyadmin requests to NOT write to and go to my document root directory and run these applications outside of the rewrite. Can you help me find 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 www.domain.com/blog and www.domain.com/phpmyadmin.

Apache 2.2.13

Thank!

+3
2

URL-, /blog/ /phpmyadmin/, :

RewriteRule ^/(?:blog|phpmyadmin)/ - [L]

( RewriteCond, phpmyadmin).

: URL-, /blog/ /phpmyadmin/, (- ), ([L]).


:

, . , RewriteCond . , - , . - :

RewriteRule ^/blog/(.*)$ /index.php?url=$1 [QSA,L]

, URL- /blog/foo/bar /index.php?url=foo%2fbar? , , , .

+2

Err... , . "" / /-/ javascript PHPMyAdmin? , - "" dirrrrty "

# Enable the RewriteEngine
RewriteEngine   On
RewriteBase     /

# Check if the file, directory or symlink does not already exists.
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-F
RewriteCond %{REQUEST_FILENAME} !favicon\.ico
RewriteCond %{REQUEST_FILENAME} !robots\.txt

# Rewrite all other requests to the index.php
RewriteRule ^(.+)$  /index.php?url=$1       [QSA,L]
0

Source: https://habr.com/ru/post/1725692/


All Articles