homepage Welcome to WebmasterWorld Guest from 54.163.139.36
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

    
dot after domain before the slash
FQDN-format duplicate URLs
getoffmyisland



 
Msg#: 4217110 posted 11:19 am on Oct 15, 2010 (gmt 0)

Hey I cant seem to find a solution to my problem,

A site of mine had this problem:

http://www.example.com./lots-of-urls-like-these/

I want all urls after the 3rd dot to redirect to a url without the dot.

for example:

Redirect
http://www.example.com./lots-of-urls-like-these/
to this:
http://www.example.com/lots-of-urls-like-these/

The dot after com should always be removed.

Hope u can help.

 

jdMorgan

WebmasterWorld Senior Member jdmorgan us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 4217110 posted 12:21 pm on Oct 15, 2010 (gmt 0)

This is a valid "Fully Qualified Domain Name" or "FQDN" format.

You may also get requests like http://www.example.com:80/lots-of-urls-like-these/ and/or http://www.example.com.:80/lots-of-urls-like-these/

Simple enough to take care of these on most servers... What have you tried so far? Do you intend to put a fix into your .htaccess file, and if so, do you have any other working server config code in it? Does this site use (or plan to use) any other subdomains in addition to the current "www"?

Jim

getoffmyisland



 
Msg#: 4217110 posted 12:51 pm on Oct 15, 2010 (gmt 0)

I've just tried this:
RewriteCond %{SERVER_PORT} 80
RewriteCond %{REQUEST_URI} somefolder
RewriteRule ^(.*)$ https://www.example.com/somefolder/$1 [R,L]
,but this is not at all what i want to do.

Yes i intent to put it in .htaccess.
Yes i have working config code, non-www to www redirect, redirects to take away index.php and a couple of normal Redirect 301's.

No there's no other subdomains other than www. and dont intent to use any other subdomains

getoffmyisland



 
Msg#: 4217110 posted 12:59 pm on Oct 15, 2010 (gmt 0)

I found these 404's while running a scan to check for broken links, i'm scared google picks it up as well, site is a CMS

jdMorgan

WebmasterWorld Senior Member jdmorgan us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 4217110 posted 2:00 pm on Oct 15, 2010 (gmt 0)

Replace your existing "non-www to www" redirect with a more robust rule:

# Externally redirect *all* non-blank non-canonical hostname requests to canonical hostname
RewriteCond %{HTTP_HOST} !^(www\.example\.com)?$
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]

This rule redirects if the hostname is not blank and if it is not *exactly* "www.example.com". It therefore catches casing errors, FQDN-format domains, and appended port numbers as previously described.

The "blank exclusion" is for HTTP/1.0 (and prior) requests. If the hostname is blank, then the request is HTTP/1.0, and trying to redirect it will result in an infinite loop, since true HTTP/1.0 requests will always have a blank hostname. Therefore, the embedded blank exclusion is used to prevent this potential loop.

Be sure your rules are in the correct order, as this is critical to success: [webmasterworld.com...]

Jim

getoffmyisland



 
Msg#: 4217110 posted 12:33 pm on Oct 19, 2010 (gmt 0)

hey jim,

This rule is a very good replacement for the normal "non www rule" i always used.

For .co.za domains, the condition will look so, (www\.example\.co\.za)?$

and after a big struggle i managed to get the rules in the correct order, yes, very critical to success.

thanks

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved