Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

htaccess stop processing if given directory

I have an instalation on my htdocs folder that needs rewriterules to be processed like this:

RewriteEngine On
RewriteCond %{ENV:REDIRECT_STATUS} ^$

RewriteCond %{HTTP_HOST} ^(?:www\.)?(.+)$ 
RewriteCond %{REQUEST_URI} !^/admin? 
RewriteCond %{REQUEST_URI} !^/payment? 
RewriteRule ^(.*)$ %1/$1 [QSA]

RewriteCond %{HTTP_HOST} ^(?:www\.)?(.+)$
RewriteRule ^admin/(.*)?$ BACKEND-PHP/$1?domain=%1 [QSA]

RewriteCond %{HTTP_HOST} ^(?:www\.)?(.+)$
RewriteRule ^payment/(.*)?$ PAYPAL-API/$1?domain=%1 [QSA]

But now, to test joomla i need add some rule in the htaccess file that stop processing rules if the given directory is "localhost/joomla" in order to joomla work properly.

in pseudocode will be like this:

RewriteEngine On
RewriteCond %{ENV:REDIRECT_STATUS} ^$

**RewriteCond %{HTTP_HOST} ^(localhost)$ 
**RewriteRule ^/joomla$ [END]

# (if the requested file is at joomla directory 
# htaccess will stop processing)

RewriteCond %{HTTP_HOST} ^(?:www\.)?(.+)$ 
RewriteCond %{REQUEST_URI} !^/admin? 
RewriteCond %{REQUEST_URI} !^/payment? 
RewriteRule ^(.*)$ %1/$1 [QSA]

RewriteCond %{HTTP_HOST} ^(?:www\.)?(.+)$
RewriteRule ^admin/(.*)?$ BACKEND-PHP/$1?domain=%1 [QSA]

RewriteCond %{HTTP_HOST} ^(?:www\.)?(.+)$
RewriteRule ^payment/(.*)?$ PAYPAL-API/$1?domain=%1 [QSA]
like image 956
k1r0s Avatar asked Nov 24 '25 18:11

k1r0s


1 Answers

You were close. Just modify your rules to

RewriteCond %{HTTP_HOST} ^localhost$ [NC]
RewriteRule ^joomla(/.*)?$ - [END]

The - says we do no processing on this URL. The [End] flag prevents all the rules below from firing.

like image 61
Ravi K Thapliyal Avatar answered Nov 27 '25 06:11

Ravi K Thapliyal



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!