I would like to redirect a sub/sub folder url to a specific URL.
It works with normal redirections like:
Redirect /folder https://mydomain.com/therestoftheurl
But i need alot of folder/folder1 or folder/folder2 redirections. It won't work with this:
Redirect /folder/folder1 https://domain.com/target
I found a reverse Question about this with this solution.
RewriteCond %{HTTP_HOST} ^mydomain.in$ [OR]
RewriteCond %{HTTP_HOST} ^www.mydomain.in$
RewriteCond %{REQUEST_URI} !^/users
rewriterule ^(.*)$ http://mydomain.com/$1 [R=301,L]
So if i'm not misstaken I could use this without "!" like so. But i think i'm missing something.
RewriteCond %{HTTP_HOST} ^mydomain.in$ [OR]
RewriteCond %{HTTP_HOST} ^www.mydomain.in$
RewriteCond %{REQUEST_URI} ^/folder/folder$
rewriterule ^(.*)$ http://mydomain.com/$1 [R=301,L]
and then the redirections which i don't know at this moment to write. Thanks for the quick help.
You just need to re-order your directives so that the one with subfolders come before the parent redirect:
Redirect /folder/folder1 https://domain.com/target
Redirect /folder https://mydomain.com/therestoftheurl
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments