Web Hosting Geeks | Web Hosting Experts
Need help? Call us 1(866)TOP-HOST

14120 reviews 1680 hosting providers

Questions & Answers

reditecting pages in .htaccess file

Oct 8, 2012 by sally23
Hello,
I am trying to redirect http://mywebsite.com/editors/a/page/2 tohttp://mywebsite.com/page/2 (the number is a  dynamic variable). I tried the following line in  mod-rewrite rules in my .htaccess file
RewriteRule ^editor/a/page(.*)$ http://mywebsite.com/page$1 [L,R=301]
But nothing is happening. Any help achieving this will be very much appreciated.
Many thanks

2 Answers

0 votes
Oct 8, 2012 by TopNet
The line you have seems correct, make sure you have  RewriteEngine On
before this line
0 votes
Oct 8, 2012 by SmartHost
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^editor/a/page(.*)$ http://website.com/page$1 [L,R=301]
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>