Reputation: 4368
Sorry if this has already been asked I had a read but I'm worried about making a mistake in my .htaccess
file so wanted to make sure I was making the right changes.
So I have a url that looks like www.example.com/folders/my-blog
and I want this URL to be www.example.com/my-blog
. I have multiple different pages on here so I don't want everything in the /folders
having the URL rewrote to just /
I only want that one page which is my-blog
having the rewrite on.
I've read about using RedirectCond
and RedirectRule
but it doesn't seem to do what I want it to.
Upvotes: 0
Views: 37
Reputation: 891
With a rewriting rule you should have something like that :
RewriteEngine On
RewriteRule ^(.*)$ /my-blog/$1 [R=301,L]
Put this in a .htaccess
file, in your folders/my-blog
folder.
Upvotes: 0
Reputation: 7476
Try below rule, by using below rule it will only affect your my-blog page folders directory.
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^my-blog$ folders/my-blog [L]
Upvotes: 1