To redirect a subdomain without passing on the query strings in the URLs, you can use a 301 redirect in your server's .htaccess file. The code should be added to the top of the file and would look something like this:
RewriteCond %{QUERY_STRING} !="" RewriteRule ^ http://newsubdomain.example.com/? [L,R=301]
This code will redirect all requests from the old subdomain to the new subdomain without passing on any query strings. The [L,R=301] flags at the end of the line indicate that this is a permanent, 301 redirect.
It's important to note that this method will only work if the subdomains have the same URL structure. If the URLs are significantly different, the redirection may not work as intended.
Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss
Asked: 2022-01-02 11:00:00 +0000
Seen: 12 times
Last updated: Mar 23 '22
What is the JSON_QUERY path in SQL Server 2019?
I want to form a union query in Access, but the format of a field is altered by the query.
Can you reword this query: Interpolation of Time Series?
What is the way to identify boolean queries that are not valid, and do not have parentheses?
What does it mean when the data type received in rtk query is undefined?
How to create a must-exist query in Elasticsearch?
How do I add a 301 redirect containing the query parameter "?page=" in my Django "urls.py" file?
Can you provide an explanation of the relationship between React query and SSE?