Reputation: 132
I need to create a 301 redirect using .HTACCESS file from a root of a directory to another:
www.domain.com/source/?var=1 ----> www.domain.com/target/?var=1
but NOT if there if the url contains any page or subdirectory:
www.domain.com/source/pretty_page/?var=1
Upvotes: 1
Views: 49
Reputation: 785481
You can use this rule in your DOCUMENT_ROOT/.htaccess
file:
RewriteEngine On
RewriteRule ^source/?$ /target [L,NC,R=301]
Upvotes: 1