: How does one redirect from one wordpress page to another via htaccess? I tried making the following change to my wordpress site to permanently redirect a common link to a new page. I could've
I tried making the following change to my wordpress site to permanently redirect a common link to a new page. I could've -sworn- that this used to work. But it simply does not (at least in WP 3.9). I have had to resort to using a Redirect Plug-In.
I'm wondering -why- it doesn't work and if there is a technique which -will- work. I'd prefer to continue to use .htaccess for simplicity.
Below is the .htaccess file:
# MY CHANGES
Redirect 301 mysite.com/gigs mysite.com/booking/
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
Again, it works by using a redirect plug-in inside WP, but there must be a way to force the 'redirection' to occur -before- the URL is passed to the WP engine, right? How is the done?
More posts by @Smith883
2 Comments
Sorted by latest first Latest Oldest Best
Your syntax for Redirect is wrong.
The first URL should be relative
The second URL should be abolute
Try this instead:
Redirect 301 /gigs example.com/booking/
To use Redirect you need mod_alias enabled in your apache configuration. If it is not working, it is likely that this module is not enabled.
As you are using mod_rewrite module for redirects already and it is enabled, you should really use RewriteRule:
RewriteRule ^/gigs$ example.com/booking/ [R=301,L,NE]
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.