Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.htaccess skip all rules if url matches

I want to skip all rewrite URLs when specific URL matches. I want to open this page:

https://www.example.com/.well-known/pki-validation/godaddy.html

If godaddy.html matches the URL. Here is what i am doing:

RewriteCond "%{REQUEST_URI}" "==/godaddy.html" 
RewriteRule ^(.*)$  https://www.example.com/.well-known/pki-validation/godaddy.html [L]
RewriteCond %{HTTP_HOST} ^example.com
RewriteRule ^(.*)$ https://www.example.com/index.php

but it does not work. I have also tried the [END] flag, but when I write flag [END] it gives me 500 internal server error.

like image 587
Hassan Shahbaz Avatar asked Mar 20 '17 11:03

Hassan Shahbaz


1 Answers

If you want to stop rewriting, when the requested URL ends with godaddy.html, you can use a dash - as the substitution

Substitution of a rewrite rule is the string that replaces the original URL-path that was matched by Pattern. The Substitution may be a:
...
- (dash)
A dash indicates that no substitution should be performed (the existing path is passed through untouched). This is used when a flag (see below) needs to be applied without changing the path.

RewriteRule godaddy.html$ - [L]
like image 146
Olaf Dietsche Avatar answered Sep 16 '22 14:09

Olaf Dietsche