Webmaster Forum


Go Back   Webmaster Forum > Marketing Forums > SEO Forum

SEO Forum Search engine optimization discussions.


Reply
 
LinkBack Thread Tools Display Modes
Share |
  #1 (permalink)  
Old 03-31-2011, 03:18 AM
Junior Member
 
Join Date: 06-07-10
Posts: 10
iTrader: 0 / 0%
Need help in htaccess.

Hello to all,

I am working on site.
Now i am facing few problems with it.

I have the following urls point as my home page

http://example.com/
http://www.example.com/
http://www.example.com/index.php
http://www.example.com/Home/

can I just have one url with htacess.
www.example.com

My httaccess contains following coding
Code:
Options +FollowSymlinks RewriteEngine on RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule .* home.php [L]
now what should i write in that?
Please suggest me through htacess only.

Thanks in advance.

Last edited by snakeair; 03-31-2011 at 08:03 AM.
 
Reply With Quote
  #2 (permalink)  
Old 03-31-2011, 04:18 AM
Tiggerito's Avatar
v7n Mentor
 
Join Date: 09-12-10
Location: Adelaide, South Australia
Posts: 298
iTrader: 0 / 0%
You should first make sure all your links use the "canonical" version of that page. i.e www.example.com

You will never get a clean index if parts of you website are linking to those other variants.

Once you've sorted it out you need to make the variants cause 301 redirects to that canonical URL.

You want to redirect to the www version of the domain. To do that, this .htaccess code should work:

Code:
RewriteCond %{http_host} ^example\.com$ [NC] RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,NC,L]
Coincidentally, I've just written an online tool to generate the other redirects you want:

http://seo-website-designer.com/HtAc...rect-Generator

If you feed in the old,new pages to the tool it will generate the .htaccess code you need. i.e.

Code:
index.php, / Home/, /
will create the .htaccess code you need (I've also included the www redirect and your SEF code for completeness)

Code:
# Needed before any rewriting RewriteEngine On ### www Redirect RewriteCond %{http_host} ^example\.com$ [NC] RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,NC,L] ### Built using the .htaccess 301 Redirect Generator from Web Site Advantage ### http://seo-website-designer.com/HtAccess-301-Redirect-Generator ### Place after 'RewriteEngine On' and before any CMS specific rewrite rules ## 301 Redirects # 301 Redirect 1 RewriteCond %{QUERY_STRING} ^$ RewriteRule ^index\.php$ / [R=301,NE,NC,L] # 301 Redirect 2 RewriteCond %{QUERY_STRING} ^$ RewriteRule ^Home/$ / [R=301,NE,NC,L] ### The SEF code Options +FollowSymlinks RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule .* home.php [L]
Tell me if it works. I've only just created the tool so it's not been tested in a million scenarios yet!
__________________
By Tony McCreath, owner of Web Site Advantage
Do not try this at home!
 
Reply With Quote
  #3 (permalink)  
Old 03-31-2011, 07:58 PM
Junior Member
 
Join Date: 06-07-10
Posts: 10
iTrader: 0 / 0%
Thanks mate for try to help me. But i am still confuse.
Can give me the code of it.
 
Reply With Quote
  #4 (permalink)  
Old 03-31-2011, 09:40 PM
Tiggerito's Avatar
v7n Mentor
 
Join Date: 09-12-10
Location: Adelaide, South Australia
Posts: 298
iTrader: 0 / 0%
The last code block was the code, or do you mean something different?

Please explain your issue more.
__________________
By Tony McCreath, owner of Web Site Advantage
Do not try this at home!
 
Reply With Quote
  #5 (permalink)  
Old 03-31-2011, 10:53 PM
Junior Member
 
Join Date: 06-07-10
Posts: 10
iTrader: 0 / 0%
Thanks i will try to put this. But example.com is just a example...

so perhaps it is a problem for me.
 
Reply With Quote
  #6 (permalink)  
Old 04-01-2011, 12:14 AM
Tiggerito's Avatar
v7n Mentor
 
Join Date: 09-12-10
Location: Adelaide, South Australia
Posts: 298
iTrader: 0 / 0%
Where I've used example\.com just remember to add a slash (/) before any dots (.) in the domain name.

I may add domain redirecting to my tool.
__________________
By Tony McCreath, owner of Web Site Advantage
Do not try this at home!
 
Reply With Quote
Go Back   Webmaster Forum > Marketing Forums > SEO Forum

Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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 Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with .htaccess HipChickHeather SEO Forum 2 12-29-2010 03:00 PM
Conflict, What is the right htaccess rule, default homepage file with htaccess? basketmen Coding Forum 2 01-20-2009 07:50 AM
htaccess help kwvarga Coding Forum 8 03-21-2006 04:42 AM
.htaccess sim Coding Forum 5 01-24-2005 02:54 PM
What can you do with .htaccess? Jason Web Design Lobby 4 12-03-2004 10:39 PM


V7N Network
Get exposure! V7N I Love Photography V7N SEO Blog V7N Directory


All times are GMT -7. The time now is 11:37 PM.
Powered by vBulletin
Copyright © 2000-2013 Jelsoft Enterprises Limited.
Copyright © 2003 - 2013 Escalate Media LP




Search Engine Optimization by vBSEO 3.6.0 RC 2 ©2011, Crawlability, Inc.