I'm trying to setup an htaccess redirect with query just like this:
Redirect 301 /?page=services/branddevelopment /brand-development?
or this:
RewriteCond %{QUERY_STRING} ^page=services/branddevelopment$
RewriteRule ^(.*)$ http://domainname/ [R=301,L]
Am I missing something in here? Or a wrong syntax? It doesn't redirect the way I want it to be. Thanks!
Am I missing something in here? Or a wrong syntax? It doesn't redirect the way I want it to be. Thanks!
You really didn't explain much about what is happening and the result you are getting so that someone can tell why you are getting the result you are getting.
However in general you can't use mod_alias
(Redirect) to redirect a query string it won't work.
You have to use mod_rewrite
, which it seems like you were trying to do. However you don't want to carry over the query string with the redirect so you need to use ?
in the rewrite URL.
So if you have a URL like so
http://www.example.com/?page=services/branddevelopment
Then your rule would be
RewriteCond %{QUERY_STRING} ^page=services/branddevelopment$
RewriteRule ^(.*)$ http://domain.com/? [R=301,L]
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.