Irish SEO,  Marketing & Webmaster Discussion

 

.htaccess query

This is a discussion on .htaccess query within the Server / Technical Administration Tips and Queries forums, part of the Webmaster Help category; Hi guys, i wish to add to the current .htaccess file that resides in my blog root so that if ...


Go Back   Irish SEO, Marketing & Webmaster Discussion > Webmaster Help > Server / Technical Administration Tips and Queries

Register Forum Rules FAQDonate Members List Calendar Search Today's Posts Mark Forums Read


Notices

Reply

 

LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 19-10-2006, 09:41 PM
Cormac's Avatar
Cormac Moylan
 
Join Date: Jan 2006
Location: Baile Ath Cliath / Corcaigh
Posts: 1,247
Nominated 0 Times in 0 Posts
TOTW/F/M Award(s): 0
Cormac is a splendid one to beholdCormac is a splendid one to beholdCormac is a splendid one to beholdCormac is a splendid one to beholdCormac is a splendid one to beholdCormac is a splendid one to beholdCormac is a splendid one to beholdCormac is a splendid one to behold
Send a message via AIM to Cormac Send a message via MSN to Cormac Send a message via Yahoo to Cormac Send a message via Skype™ to Cormac
Default .htaccess query

Hi guys, i wish to add to the current .htaccess file that resides in my blog root so that if a user types in http://domain.com they're automatically redirected to http://www.domain.com.


I have opened up the current .htaccess file and I found the following:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /blog/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]
</IfModule>
# END WordPress


To enforce the www i added the following to the .htaccess file:
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_Host} ^cormacmoylan.com/blog [NC]
RewriteRule ^(.*)$ http://www.cormacmoylan.com/blog/$1 [L,R=301]


But it doesn't enforce the rule. Does anyone know where i'm going wrong?
__________________
blog | Geansaí Gorm - Written entirely in, awful, Irish! | Me on Blue Jumpers
*
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #2 (permalink)  
Old 19-10-2006, 11:12 PM
Hardcore Geek
 
Join Date: Aug 2006
Location: Dublin
Posts: 1,045
Nominated 0 Times in 0 Posts
TOTW/F/M Award(s): 0
Gavin has a spectacular aura about
Default

I dont think you need it in the blog but rather in the root folder of the domain although I find htaccess tricky at the best of times.

Try:

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

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3 (permalink)  
Old 19-10-2006, 11:25 PM
RedCardinal's Avatar
Richard Hearne
Recent Blog:
[CaRP] XML error: Invalid character at line 1108
 
Join Date: Feb 2006
Posts: 951
Nominated 0 Times in 0 Posts
TOTW/F/M Award(s): 0
RedCardinal is a splendid one to beholdRedCardinal is a splendid one to beholdRedCardinal is a splendid one to beholdRedCardinal is a splendid one to beholdRedCardinal is a splendid one to beholdRedCardinal is a splendid one to beholdRedCardinal is a splendid one to behold
Default

Where did you put the second block?

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
Options +FollowSymLinks
RewriteCond %{HTTP_Host} ^cormacmoylan.com/blog [NC]
RewriteRule ^(.*)$ http://www.cormacmoylan.com/blog/$1 [L,R=301]
RewriteBase /blog/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]
</IfModule>
# END WordPress

Similar works for me except it appears WP takes it upon itself to rollback the file every so often
__________________
Search Engine Optimisation - Red Cardinal Internet Marketing
Internet Consultant Ireland | Search Engine Optimisation Services
Catering Company Dublin - My sister's handmade canape company!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4 (permalink)  
Old 20-10-2006, 12:56 AM
blacknight's Avatar
Web Slave
Recent Blog:
 
Join Date: Jan 2006
Location: Ireland
Posts: 6,521
blacknight is a splendid one to beholdblacknight is a splendid one to beholdblacknight is a splendid one to beholdblacknight is a splendid one to beholdblacknight is a splendid one to beholdblacknight is a splendid one to beholdblacknight is a splendid one to behold
Send a message via ICQ to blacknight Send a message via AIM to blacknight Send a message via MSN to blacknight
Default

If you want to rewrite the entire domain then it should be in the root
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5 (permalink)  
Old 20-10-2006, 09:54 AM
Redfly's Avatar
Dave Davis
 
Join Date: Sep 2006
Location: Dublin, Ireland
Posts: 1,063
Nominated 0 Times in 0 Posts
TOTW/F/M Award(s): 0
Redfly is a splendid one to beholdRedfly is a splendid one to beholdRedfly is a splendid one to beholdRedfly is a splendid one to beholdRedfly is a splendid one to beholdRedfly is a splendid one to beholdRedfly is a splendid one to behold
Send a message via AIM to Redfly Send a message via MSN to Redfly Send a message via Yahoo to Redfly Send a message via Skype™ to Redfly
Default

RewriteEngine On

RewriteCond %{HTTP_HOST} !^(www\.|$) [NC]
RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

Then in your case, /blog
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
htaccess, query

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
Forum Jump


Sponsored links

Paid On Results


All times are GMT +1. The time now is 11:48 AM.


Powered by: vBulletin Version 3.7.3, Copyright ©2000 - 2008, Jelsoft Enterprises Limited.
Hosted in Ireland by Blacknight - Test your ISP |Irish Hosting Directory| Armchair.ie|Logo by Eden Web Design|Avatars by Afterglow |Latest Blog Entries | VPS HostingAd Management by RedTyger

Search Engine Friendly URLs by vBSEO 3.2.0