The old domain is:
www.example.com/newspage.asp?m=4&y=2015
and I need that URL, as well as that URL with different query paramaters to go to:
example.com/news
.
So, you are also changing the host with this redirect (www subdomain to bare domain)? Otherwise, it just looks like you can ignore the query string. This is relatively trivial to do with mod_rewrite. The following directives would need to go near the top of your .htaccess
file, before the WordPress front controller.
RewriteRule ^newspage\.asp$ http://example.com/news? [R=301,L]
This matches any query string.
The ?
on the end of the RewriteRule
substitution removes the query string from the request. Otherwise, it gets passed through to the target URL. Alternatively, on Apache 2.4+, you can use the QSD
(Query String Discard) flag instead.
Related Posts:
- Rewrite /?rest_route=/ link to /wp-json/ without changing default permalink structure in apache
- index.php not loading in main folder of wordpress
- Redirect from different port to subdomain – htaccess
- WordPress 404 on Subdomain
- Only expose routes with prefix /wp-json on WordPress using Apache
- What’s the opposite of required valid user in .htaccess authentication
- How can i redirect one url to another url using .htaccess or add_rewrite_rule
- Override htacces rule only for specific directory
- Restrict uploaded files into a custom folder to logged in users by htaccess: looking for Nginx – not only Apache – solution
- How do I test to ensure that my wp-config file is protected?
- .htaccess Security Header Rules
- mod_rewrite loop, redirecting http to https on certain section of wordpress blog
- .htaccess in subdir gets ignored by WordPress’ own .htaccess in /
- Directing subdomain to main domain and keeping the subdomain format with .htaccess
- WordPress – Promoting A Dev Build In A Subdirectory To Production / Root Directory
- Does WP suppresses .htaccess if permalinks are disabled?
- fix 302 redirection error on https
- Access sub-domain when root public_html is protected with .htaccess password
- Accepting special characters in querystring
- WordPress permalinks confusion
- Configure .htaccess to have a WordPress single site installation with all subdomains pointing to the same pages?
- Unable leverage Browser Caching on AWS Bitnami stack (Apache) through W3TC and Cloudfront CDN
- How to move wordpress website from hosting account to localhost
- How to block wordpress admin by htaccess
- I can access subdirectory, but not files within it
- WordPress redirection
- How To Add CSP frame ancestors in WordPress Website? [closed]
- Subfolder install not working
- Browser Caching .htaccess
- How do I disable directory browsing?
- Https to http redirect using htaccess
- Improve wordpress security by hiding non public resources
- htaccess rewrite conflict with wordpress rules and ssl
- adding rewrite rules in .htaccess
- Remove year and month in URL using .htaccess
- Permalinks not working on second wordpress installed in a subdirect
- Unable to access WP admin
- Move wordpress to folder without changing urls
- Using WordPress only for the backend, and using AngularJS as a frontend
- Two domains on one WordPress Installation
- Protect Upload Folder Files With Ampersand Problem
- .htaccess and WordPress Admin Bar
- Blocking access to wp-login via htaccess not working
- How to Redirect huge numbers of URLs to another URLs?
- Struggling with add_rewrite_rule
- Giving WordPress its own subdirectory – nginx
- Cannot mask WordPress page URL using .htaccess
- How can I make an htaccess file on a Mac? [closed]
- 404 with post name permalinks
- Restricting user login by IP address
- WordPress overrides custom 404 page with it’s own
- New installation can’t be found due to htaccess of the original non-WordPress site
- Case insensitive header params for API request
- 301 Redirect domain Sub-folders to Subdomain subfolder
- Drawbacks to using Options -Indexes
- Override 404 page with htaccess
- Htaccess Rewrite reverts to default .htaccess file
- what could cause the htaccess file to be modified?
- change permalink structure with htaccess without SEO impact
- Site in subfolder – all pages work except home
- Can’t upload .htaccess after editing in notepad
- Remove /sites/25/ from image URLS
- How disable canonical redirect wp-signup
- 301-redirect directives for blogger to wordpress migration
- What might be removing my redirects from my htaccess?
- WordPress .htaccess to consider blog as directory
- Redirect – remove custom query string
- Password protect directory but not files
- How to have a custom URI path for specific page template
- Where to put W3 Total Cache rewrite rules in .htaccess? [closed]
- main-domain of wordpress keep redirecting to subdomain
- How to deny access to a particular wordpress site url
- Rewrite URL in address bar for a specific page [closed]
- Home links redirects to old site
- How to set up MS Exchange Autodiscover alongside WordPress
- Rewriting subfolders to specific parent folder in WordPress
- Azure WordPress deny access to xmlrpc
- PHP application in sub directory keeps redirecting to main site
- domain redirection is not working from old to new
- Deny,Allow on .htaccess isn’t working
- Redirect WordPress site to a landing (construction) page using htaccess, with access to /wp-admin and /invoice
- Using htaccess to prevent spam through wp-comments-post.php
- Install second wordpress in root subfolder, Error 404
- URL Rewrite 404
- Remove subdirectory from links
- modifying htaccess for localhost with a custom port
- htaccess- to hide subdirectory slug only from the post
- .htaccess redirects for posts in new directory and new domain
- domain.in/wp-admin give the result to 403 Access to this resource on the server is denied!
- Restrict Content for only Contributors via .htaccess
- Redirect from domain.com to subdomain.domain.com
- MAMP.app & .htaccess – Can’t override after config
- register_post_type and register taxonomy and htaccess
- Why ‘Authorization Required’ is coming on wordpress login
- Restricting direct downloads of wp content files, but allow them on the website.
- Forward blog requests to another URL
- .htaccess rewrite rule stopped working for wordpress site after moving server
- WordPress Media Library rendering blank image tiles
- Redirect loops in Bing holding my sites back
- WP-Include rewrite directory