Link to home
Start Free TrialLog in
Avatar of Chris Andrews
Chris AndrewsFlag for United States of America

asked on

.htaccess redirect help needed

The old version of my site had pages in a directory:


I need to direct any traffic going to anything in those directories, either the main or the subdirectory, to my new wordpress page, which is at:    (yep, in wordpress, that's a page, not a real directory, not sure how that works). Using the permalinks option to do that.

What would I put in my .htaccess file to do this?


Avatar of Kent Dyer
Kent Dyer
Flag of United States of America image

You mean something like:
RewriteCond %{HTTP_HOST} ^$ [OR]
RewriteCond %{HTTP_HOST} ^$
RewriteRule ^/?$ "http\:\/\/www\.mysite\.com\/subdir/page.htm" [R=301,L]

Open in new window


Avatar of Jason C. Levine
Jason C. Levine
Flag of United States of America image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Chris Andrews


RewriteRule ^dir/(.*)$ /dir/ [L,R=301]

Looks to be the most efficient way to do this - and it works to redirect to /dir/ - but when it does, I get an error page saying there were too many redirects. (redirect loop)

I'm sorry, I should have included this before, but my current .htaccess has this in it:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

(from what the permalink wp page gave me to enter in it)

Any line I put the redirect on that worked (redirected) gave me an error when it got to the actual page.

Got this worked out, thank you.