Go Back   CodingForums.com > :: Server side development > Apache configuration

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 03-19-2011, 09:51 PM   PM User | #1
will_m
New Coder

 
Join Date: Mar 2011
Location: Manchester U.K
Posts: 30
Thanks: 14
Thanked 0 Times in 0 Posts
will_m is an unknown quantity at this point
Problems setting up www. redirects

Hi there, I've recently been informed that most of my site maybe misinterpreted by search engines as I don't have 301 redirects set-up and therefore a lot of my pages are appearing as duplicates, a www. version and one without.

So far I've been following this guide on how to set-up the redirects I need:

http://www.squidoo.com/301

In one of the first steps it mentions you need apache, which I'm not sure if my host has (1and1.co.uk)

There is also a step to locate the file httpd.conf on my server but i cannot find it anywhere. I've followed all of the other instructions but when I go to my site williammorrismusic.com it doesn't redirect to the www. version. Any ideas?
will_m is offline   Reply With Quote
Old 03-20-2011, 03:42 PM   PM User | #2
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,662
Thanks: 4
Thanked 2,452 Times in 2,421 Posts
Fou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to all
You'll only be able to access the httpd.conf if you have full control of the machine. If its a shared hosting, you need to cross your fingers that they allow .htaccess to override the type.
All that article (just briefly looked over the code used) looks like it will work in the .htaccess except the directives in the block for Options +..., which I believe can only be set in httpd.conf, and the loadmodule I think is also httpd.conf level only.
Simply use:
Code:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^mysite.com
RewriteRule (.*) http://www.mysite.com/$1 [R=301,L]
should work.
__________________
As of PHP 5.5, the MySQL library has been officially deprecated. It is recommended to move to either MySQLi or PDO libraries for your mysql connectivity. See here for help choosing which interface you prefer: http://php.net/manual/en/mysqlinfo.api.choosing.php
Fou-Lu is offline   Reply With Quote
Users who have thanked Fou-Lu for this post:
will_m (03-22-2011)
Old 03-22-2011, 02:18 AM   PM User | #3
will_m
New Coder

 
Join Date: Mar 2011
Location: Manchester U.K
Posts: 30
Thanks: 14
Thanked 0 Times in 0 Posts
will_m is an unknown quantity at this point
Ah I've just discovered I don't have apache as I'm on a windows server so the redirects will have to be done like so:

http://faq.oneandone.co.uk/scripting/asp_net/10.html

Does that code need to go on every page then?
will_m is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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

Forum Jump


All times are GMT +1. The time now is 10:15 AM.


Advertisement
Log in to turn off these ads.