Htaccess URL Redirect
-
I run a site for work at healthiercolorado.org. Right now we have a WordPress installation at blog.healthiercolorado.org, but I will be moving it to just healthiercolorado.org this weekend and getting rid of the existing site in the root directory. I know how to do the move, but I have a question about redirects.
I need to ensure that the link: http://blog.healthiercolorado.org/food-policy/add-your-voice-to-our-farm-to-school-campaign/ redirects to just: http://healthiercolorado.org/food-policy/add-your-voice-to-our-farm-to-school-campaign/ and that the link: http://blog.healthiercolorado.org/public-health/let-cdphe-know-we-support-the-proposed-immunization-rules/ redirects to just: http://healthiercolorado.org/public-health/let-cdphe-know-we-support-the-proposed-immunization-rules/, so that people who have the old links can still use them.
1. My current .htaccess file reads:
# 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># END WordPress
Would the correct rewrite of this for the redirect be:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule blog.healthiercolorado.org/public-health/let-cdphe-know-we-support-the-proposed-immunization-rules/$ healthiercolorado.org/public-health/let-cdphe-know-we-support-the-proposed-immunization-rules/ [R]
RewriteRule blog.healthiercolorado.org/food-policy/add-your-voice-to-our-farm-to-school-campaign/$ healthiercolorado.org/food-policy/add-your-voice-to-our-farm-to-school-campaign/ [R]
RewriteBase /
RewriteRule ^index\.php$ – [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule># END WordPress
2. Is there any way to do this redirect without editing the .htaccess file? I would prefer to avoid this if at all possible, though I understand if it is is not possible.
Thank you all so much for your help.
The topic ‘Htaccess URL Redirect’ is closed to new replies.