I went through all the answered threads on rewrite rule problem. Tried the suggestions, But I still don't know what I am doing wrong.
I want to make a 301 redirect of our old URLs to the new ones. Example:
old url : http://www.xyz.com/abc/topics.html
new url : http://www.xyz.com/index.php#first
I am trying following rule in .htaccess:
RewriteEngine on
RewriteRule ^\/abc\/(.+)$ http://www.xyz.com/index.php#first [L,R=301]
Any advice is highly appreciated
A 301 Permanent Redirect permanently redirects one URL to another. You set up a 301 redirect using . htaccess to send visitors to a new URL and tell search engines that a page has moved so that the new page can be properly indexed.
The . Because the WordPress 301 redirect is not always reliable, we recommend issuing the 301 redirect via your . htaccess file. Another benefit is that the . htaccess redirect is slightly faster than redirecting via PHP, because it is loaded even before the rest of the page.
Try this:
RewriteRule ^abc\/(.+)$ http://www.example.com/index.php#first [L,R=301,NE]
You can, of course, do it by "mod_rewrite", but in this situation I'd suggest you use mod_alias as it is faster and simpler (see this SO response: mod_rewrite or mod_alias?)
Like this:
Redirect permanent /abc http://www.xyz.com/index.php#first
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With