I have the following code in my .htaccess file in the folder
http://localhost/modrewrite/test/
RewriteCond %{REQUEST_URI} ^modrewrite/.*$
RewriteRule b.html [L]
All I want to do is whenever I go to index.php in that above folder, i want it redirected to b.html. I know this can be done by just using
RewriteEngine on
RewriteRule index.php b.html [L]
but I want to use RewriteCond and %{REQUEST_URI} to see how it actually works. Thanks.
" I want to use RewriteCond and %{REQUEST_URI}
"
You can try this rule:
RewriteEngine on
RewriteCond %{REQUEST_URI} index\.php
RewriteRule ^ b.html [L]
Though I will suggest that other rule is much cleaner ie
RewriteRule ^index\.php$ b.html [L,NC]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.