Reputation: 59
I am making a .htaccess
file with various mod_rewrite
rules. At the moment, one of my rules is
RewriteRule ^blog /directorypath/index.php [L]
http://www.example.com/blogfjdkkfnfdjn
, it still loads the blog
page.
Basically, I am looking for the regex for it to load the blog when JUST `/blog` is typed in and nothing else
Upvotes: 0
Views: 82
Reputation: 49867
You can use:
Redirect permanent /blog /directorypath/index.php
If you need a temporary you can use: 302
instead of permanent
OR
RewriteRule ^blog/?$ /directorypath/index.php [R=301,L]
If you need a temporary you can use: R=302
Upvotes: 1
Reputation: 9509
If you access your blog via /blog
or /blog/
then I would use
RewriteRule ^blog/?$ /directorypath/index.php [L]
Upvotes: 0
Reputation: 9858
Add the $
character to the expression
RewriteRule ^blog$ /directorypath/index.php [L]
Upvotes: 0