Webmaster Key - Discussion Forums


Welcome, Guest. Please login or register.
Did you miss your activation email?
February 07, 2012, 10:03:42 AM

Login with username, password and session length
Welceome to Forums!

Important information for guests and new members:

In order to understand the full benefits of becoming an active member of this forum, please review the following information on guest and new member restrictions. These forum changes have been prompted by an overwhelming and unreasonable amount of bot postings and incoherent guest spam messages. We wish to prevent these events from happening in the future and make our community a more comfortable place for all of our members.

For guests:

Guests are not allowed to open new topics, polls, or posts attachments.
If you wish to open up new discussions on this forum, we encourage you to register.

For new members:

New members with less than five posts are not allowed to modify additional profile information such as avatars, contact information, biographies, and signatures. However, new members are encouraged to post their own topics or reply to topics initiated by other members. Become active on the forums and 5 posts should be an easy task!

We are a diverse community with members from all over the world. We encourage new ideas and interesting conversation. Do not be afraid to post webmaster/computer-related questions or problems, as our active members are always willing to help when they are able. Interested? Join us.

+ Webmaster Key Forums
|-+ Webmaster Corner
| |-+ Site Design and Web Authoring
| | |-+ Coding Talk
| | | |-+ Redirecting URL to WWW
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] Go Down Stumble Upon! Digg It! del.icio.us! Add to Technorati! ReddIt!  Send this topic Print
Author Topic: Redirecting URL to WWW  (Read 3982 times)
Andy
Administrator
Veteran
*****
Posts: 5 752



« on: April 04, 2008, 09:51:51 AM »

What's the best way to redirect any URLs pointing to your site to make sure that they always include www in the url?

In .htaccess we can use a 301 redirect but I am not sure how to only make this work for URLs that are missing the "www."

I didn't want to redirect every URL.

This is for SEO reasons to prevent search engines seeing duplicate content. If indeed it is an issue to be concerned about.
Report to moderator   Logged

SensoVision
Administrator
Veteran
*****
Posts: 5 857


I'm proud user of Debian GNU/Linux OS


WWW
« Reply #1 on: April 04, 2008, 11:25:09 AM »

I'm using this code for URL's unification:
Quote
RewriteEngine On
RewriteCond %{HTTP_HOST} ^yoursiteurl\.net$
RewriteRule ^(.*)$  http://www.yoursiteurl.net/$1 [R=permanent]

Would it work for you?

Quote
This is for SEO reasons to prevent search engines seeing duplicate content. If indeed it is an issue to be concerned about.
I've got feeling that at least Google perfectly distinguish such cases now and don't consider domain without www. and one with it as different sites.
Report to moderator   Logged

Denis
Andy
Administrator
Veteran
*****
Posts: 5 752



« Reply #2 on: April 04, 2008, 02:23:42 PM »

My customer requested it and I don't personally bother about it.

I think what you posted is OK but you are telling the search engine that every single request is a permanent re-direct I think. This is the problem I see with these techniques, I would rather it is only actioned when the www. is missing.

If there is no solution, then I will just ignore the customer request  Wink anyway, the site navigation structure should avoid this problem naturally, if I did my job correctly.
Report to moderator   Logged

SensoVision
Administrator
Veteran
*****
Posts: 5 857


I'm proud user of Debian GNU/Linux OS


WWW
« Reply #3 on: April 04, 2008, 02:46:17 PM »

I think what you posted is OK but you are telling the search engine that every single request is a permanent re-direct I think. This is the problem I see with these techniques, I would rather it is only actioned when the www. is missing.
you're wrong, Andy, it's only matching requests to domain which missing WWW, just as you requested.
here is quote from http://en.wikipedia.org/wiki/Regular_expression
Quote
^    Matches the starting position within the string. In line-based tools, it matches the starting position of any line.
So it's only match domain if nothing was input before, it like subdomain.

to make sure you can try to check with this tool:
http://www.internetofficer.com/seo-tool/redirect-check/
Check http://pharos-search.com and http://www.pharos-search.com
As I have this code installed there.

Quote
If there is no solution, then I will just ignore the customer request  Wink anyway, the site navigation structure should avoid this problem naturally, if I did my job correctly.
of course, you should always use one style of URL everywhere, especially in your site.
Report to moderator   Logged

Denis
Andy
Administrator
Veteran
*****
Posts: 5 752



« Reply #4 on: April 04, 2008, 03:06:04 PM »

Thanks Denis, I didn't study it hard. Thanks a lot for the effort you put into this solution.

Andy
Report to moderator   Logged

SensoVision
Administrator
Veteran
*****
Posts: 5 857


I'm proud user of Debian GNU/Linux OS


WWW
« Reply #5 on: April 04, 2008, 03:27:56 PM »

Thanks Denis, I didn't study it hard. Thanks a lot for the effort you put into this solution.
my pleasure Smiley It wasn't big effort actually and I'm almost sure it would be useful for more people who find this thread.
Hope it would work out for your client.
Report to moderator   Logged

Denis
donecweb
Administrator
Veteran
*****
Posts: 1 302


DonecWeb


« Reply #6 on: April 04, 2008, 05:02:08 PM »

Quote
I'm using this code for URL's unification:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^yoursiteurl\.net$
RewriteRule ^(.*)$  http://www.yoursiteurl.net/$1 [R=permanent]
Denis where would you place this code to make this work?
Report to moderator   Logged

DonEc Web

Links and accurate information provide the best answer, while garbage in provides garbage out.
SensoVision
Administrator
Veteran
*****
Posts: 5 857


I'm proud user of Debian GNU/Linux OS


WWW
« Reply #7 on: April 04, 2008, 05:44:04 PM »

it should be placed into file named: .htaccess in the public_html, www or docs directory on your server(it depend from your server setup, but generally it's where you have your index.php or index.htm file).

IMPORTANT: site could go offline or some bugs may appear if this file not properly used, it's very important to backup first .htaccess file which present(if it exist) on your hosting account first before applying any changes to it.

Let me know if you need help with this.
Report to moderator   Logged

Denis
donecweb
Administrator
Veteran
*****
Posts: 1 302


DonecWeb


« Reply #8 on: April 05, 2008, 12:43:21 AM »

Thanks Denis.
Report to moderator   Logged

DonEc Web

Links and accurate information provide the best answer, while garbage in provides garbage out.
carpmad
Key Keeper
Sr. Member
****
Posts: 293



WWW
« Reply #9 on: May 03, 2008, 11:50:09 AM »

ive just setup my domain tol redirect to my shop but after you go to checkout and click to pay by nochex and go off to there site it still shows as my domain so doesnt show the secure lock in the bottom corner
is there anyway to solve this so the domains limited to just my site
my shop also shows toasteds domain in the links because its hosted on that server is there anyway around that too or do i need seperate hosting for forum and shop?
Report to moderator   Logged
Andy
Administrator
Veteran
*****
Posts: 5 752



« Reply #10 on: May 03, 2008, 12:54:21 PM »

If it doesn't show the lock symbol it's probably because you are framing the secure page.

Not sure about the other problem. You can't fake the domain name in the URL.
Report to moderator   Logged

carpmad
Key Keeper
Sr. Member
****
Posts: 293



WWW
« Reply #11 on: May 03, 2008, 01:02:34 PM »

cheers Andy
so i need to get a seperate hosting package for my www.a-tractbaits.com shop to have it working properly and keep the toasteds.co.uk domain on the same server as it is now?
hope thats not the case lol i cant afford another hosting fee Grin
Report to moderator   Logged
Andy
Administrator
Veteran
*****
Posts: 5 752



« Reply #12 on: May 03, 2008, 01:19:40 PM »

Yeah, you need separate accounts for different domains. I use www.supanames.co.uk which are cheap. Having secure pages will up the cost though.
Report to moderator   Logged

Pages: [1] Go Up Stumble Upon! Digg It! del.icio.us! Add to Technorati! ReddIt!  Send this topic Print 
+ Webmaster Key Forums
|-+ Webmaster Corner
| |-+ Site Design and Web Authoring
| | |-+ Coding Talk
| | | |-+ Redirecting URL to WWW

Jump to:  
« previous next »


Our Partners
RelmaxTOP Ranking System Web Hosting RelmaxTOP Ranking System
Staff Sites
12Noon[12Noon Gallery] Andy[Urgentclick]
Tamuril[Tamuril's Digital Art Exhibit] Sensovision
Powered by MySQL Powered by PHP We are hosted by Relmax Inc. |Our Privacy Policy | Sitemap
Powered by SMF 1.1.9 | SMF © 2006-2009, Simple Machines LLC
Forum design by Tamuril © 2005.
Valid XHTML 1.0! Valid CSS!