Portal Home > Knowledgebase > Articles Database > 301 htaccess redirect exeptions?


301 htaccess redirect exeptions?




Posted by lexington, 06-28-2008, 08:57 PM
Hello, I use a working htacess redirect to redirect all pages within a directory to another: However there are a few pages that I would like to redirect to another site/page instead. So is it possible to have all pages redirect but have a few exceptions within that directory that redirect elsewhere? The reason I ask is because my site has thousands of pages in that directory that I want redirected to index.html. However there are a few user created pages from members who had lost their webpage so I would like to offer them a new page on another site and have it redirect their old url to the new one. Thanks.

Posted by greg2007, 06-29-2008, 08:20 AM
Well, firstly the code you posted will redirect all files that match to the index.html Wouldn't you want to redirect a specific file to the same file in the new dir/new site? I am in no way expert with htaccess, but I would say if you are wanting to redirect different pages within a dir to the same page names in another dir or site then you would just match in current dir and redirect to new dir/site something like RewriteRule ^(.*)$ http://www.newsite.com/$1 [L,R=301] OR RewriteRule ^(.*)$ /newfolder/$1 [L,R=301] Other ideas... RedirectMatch 301 ^/(.*)\.htm$ http://www.newsite.com/$1.html OR RedirectMatch 301 ^/(.*)\.htm$ /newdir/$1.html As I said, I'm no expert and these are just ideas, so try them in a safe/test dir first.



Was this answer helpful?

Add to Favourites Add to Favourites    Print this Article Print this Article

Also Read
Gigenet down? (Views: 611)
crunchhost.com down? (Views: 646)