Website Babble Webmaster Forums  
  #1 (permalink)  
Old 09-24-2007, 11:43 AM
Master Babbler
 
Join Date: Sep 2007
Posts: 113
Default argh what a mess..

hey guys,

i wonder if anyone can help. I setup a wordpress blog, but I want to redirect all hits from domain.com/blog to www.domain.com/blog I placed a redirect code in my .htaccess file in the root of my site by adding this code:

RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} !^www.yourdomain.com$ [NC]
RewriteRule .* http://www.yourdomain.com/ [L,R=301]


it works fine for domain.com but it doesn't work for my blog, unless i remove the .htaccess in the /blog directory. If I do that the blog pages don't work properly. anyone have any experience with this?

PS. I got the code off your site gavin!
Reply With Quote
  #2 (permalink)  
Old 09-25-2007, 09:14 AM
Master Babbler
 
Join Date: Jul 2007
Posts: 241
Default

In the CP for Word Press make sure that under General options you have the WordPress address and blog address as http://www.

I'll double check the code I have for another blog that has a similar address as yours i.e. yourdomain.com/blog/ to confirm what you have is correct. Something tells me thats the code for a blog in the root of the domain.
__________________
Reply With Quote
  #3 (permalink)  
Old 09-25-2007, 10:57 AM
Master Babbler
 
Join Date: Sep 2007
Posts: 113
Default

Quote:
Originally Posted by Gavin View Post
In the CP for Word Press make sure that under General options you have the WordPress address and blog address as http://www.

I'll double check the code I have for another blog that has a similar address as yours i.e. yourdomain.com/blog/ to confirm what you have is correct. Something tells me thats the code for a blog in the root of the domain.
Thanks for the reply.. I did change the CP to www.domain.com/blog/ It still won't direct it over to www.domain.com/blog though if I visit from domain.com/blog a lot of pages are on google using domain.com/blog so I would like to have it redirect if i can work out how..

cheers.. liked your site btw..
Reply With Quote
  #4 (permalink)  
Old 09-25-2007, 02:52 PM
Master Babbler
 
Join Date: Jul 2007
Posts: 241
Default

OK I'm using two .htaccess files for a site that has the blog in its own directory outside the root.

Place this code into the .htaccess file located in the root of your domain.

Code:
RewriteEngine on
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]*/)*index\.htm? [NC]
RewriteRule ^(([^/]*/)*)index\.htm?$ http://www.yourdomain.com/$1[R=301,L]

RewriteCond %{HTTP_HOST} ^yourdomain\.com [NC]
RewriteRule ^(.*)$ http://www.yourdomain.com/$1 [R=301,L]
Notice how the file extentsion is .htm - change this to reflect the type of extension you are using in the root i.e. html or php etc.

This is the code I'm using the .htaccess file located in the root of the /blog/ directory:

Code:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /blog/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]
</IfModule>
Give that a shot and see what happens.
__________________
Reply With Quote
  #5 (permalink)  
Old 09-25-2007, 04:04 PM
Master Babbler
 
Join Date: Sep 2007
Posts: 113
Default

Quote:
Originally Posted by Gavin View Post
OK I'm using two .htaccess files for a site that has the blog in its own directory outside the root.

Place this code into the .htaccess file located in the root of your domain.

Code:
RewriteEngine on
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]*/)*index\.htm? [NC]
RewriteRule ^(([^/]*/)*)index\.htm?$ http://www.yourdomain.com/$1[R=301,L]

RewriteCond %{HTTP_HOST} ^yourdomain\.com [NC]
RewriteRule ^(.*)$ http://www.yourdomain.com/$1 [R=301,L]
Notice how the file extentsion is .htm - change this to reflect the type of extension you are using in the root i.e. html or php etc.

This is the code I'm using the .htaccess file located in the root of the /blog/ directory:

Code:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /blog/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]
</IfModule>
Give that a shot and see what happens.
Thanks so much for trying mate, but still no joy. domain.com redirects to www.domain.com but domain.com/blog does not. I managed to find a plugin that I think has done the job.. This one http://wordpress.org/extend/plugins/...ink-validator/

It would be good to do it in htaccess though as I am not sure how search engine friendly the plugin is.

Last edited by PeterM; 09-25-2007 at 04:08 PM.
Reply With Quote
  #6 (permalink)  
Old 09-26-2007, 11:14 AM
Master Babbler
 
Join Date: Jul 2007
Posts: 241
Default

Yeah seems to work with that plugin. If it being search engine friendly is questionable with you there is always the option of adding the blog to Google's Webmaster tools. At least if Google has an issue crawling pages you'll know via their control panel.
__________________
Reply With Quote
  #7 (permalink)  
Old 09-27-2007, 05:25 PM
Master Babbler
 
Join Date: Sep 2007
Posts: 113
Default

Quote:
Originally Posted by Gavin View Post
Yeah seems to work with that plugin. If it being search engine friendly is questionable with you there is always the option of adding the blog to Google's Webmaster tools. At least if Google has an issue crawling pages you'll know via their control panel.
I didn't realise google informed you if there is a problem. I have just done that :-)

It's been very busy crawling my site this week. Infact googlebot has used more bandwidth than all of my visitors! I have some ebooks in pdf.. a couple of than are around 10 meg, it seems to like to crawl them daily.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -6. The time now is 05:05 AM.



WB Sponsors

Profit Lance Review

affiliate network

Work At Home Jobs

Expert PPC Coaching



 Subscribe to the Website Babble Feeds

2 Create a Website Homepage | 2 Create a Website Blog


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0