FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Redirect Problems - 50FRIH reward





jylan
I'm trying to do a .htaccess for my blog, which I recently moved from yeppooninfo.com/articles to yeppooninfo.com.

I would do a redirect like "Redirect 301 /articles/ http://www.yeppooninfo.com/", but that will redirect my wp-content folder (which is still in the articles folder) as well, creating 404 errors for images. I'm currently setup so that /articles/tag/, /articles/page/, and /articles/archives are redirecting to the root directory, but a lot of links are pointing to yeppooninfo.com/articles which doesn't redirect anywere.

As I've explained I can't use the simple redirect method to do that because it will affect other things as well.

I'm guessing there's a way just to redirect /articles to yeppooninfo.com, without affecting lower folders. Maybe using the more complex Mod_Rewrite rules? If anyone could post a solution to this I'll give $50FRIH Smile.
imagefree
yeppooninfo.com/articles to yeppooninfo.com.
use this: (in .htaccess)

Code:
RewriteEngine on

RewriteRule ^articles/(.+)$ /$1 [R,301]
RewriteRule ^articles/$ /index.php [R,301]
RewriteRule ^articles$ /index.php [R,301]
#use whatever you want in place of index.php, or simply remove it, the code will work.

i dont understant how your URLs (redirecting and destination) look like, if you can give an example URL of both, i can provide a better redirection code.

You also need to have mod_rewrite enabled. Just lookup it in apache config file.
jylan
Hi imagefree,

Thanks for the code, but its giving me 500 server errors. I think mod_rewrite is enabled because Wordpress is rewriting urls.
Star Wars Fanatic
imagefree wrote:
yeppooninfo.com/articles to yeppooninfo.com.
use this: (in .htaccess)

Code:
RewriteEngine on

RewriteRule ^articles/(.+)$ /$1 [R,301]
RewriteRule ^articles/$ /index.php [R,301]
RewriteRule ^articles$ /index.php [R,301]
#use whatever you want in place of index.php, or simply remove it, the code will work.

i dont understant how your URLs (redirecting and destination) look like, if you can give an example URL of both, i can provide a better redirection code.

You also need to have mod_rewrite enabled. Just lookup it in apache config file.


I think there is a bug in your code...
Try this:

Code:
RewriteEngine on

RewriteRule ^articles/(.+).php$ /$1 [R=301]
RewriteRule ^articles/$ /index.php [R=301]
RewriteRule ^articles$ /index.php [R=301]
#use whatever you want in place of index.php, or simply remove it, the code will work.


Note that it will redirect only php files, and leave all other file type alone.
jylan
Thanks Star Wars Fanatic, that works just fine.

Would it be alright if I split the FRIH up with imagefree as well as you? Because he did post the original code Smile.
Star Wars Fanatic
jylan wrote:
Thanks Star Wars Fanatic, that works just fine.

Would it be alright if I split the FRIH up with imagefree as well as you? Because he did post the original code Smile.


I don't need the Frih$, thanks though. Glad I could help.
jylan
Ok then SWF, thanks for your help anyway!
Related topics
Facing Many Problems
New forum area (computer problems)
Free Domain & Redirect Services
target = _parent redirect script?
Auto redirect your visitors to a different page
Problems With Index Page
How To : Improve Your PHP Programming
FTP problems --> Use Filezilla and/or active mode
500 FRIH$: For a custom-made storefront. (PHP)
Form & Redirect
50FRIH for making me correctly post in Wordpress Blog.
.htaccess Problem - PLEASE help - Reward Offered
session_destroy problems
Header problems
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.