homepage Welcome to WebmasterWorld Guest from 54.161.240.10
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

    
Urgent Help Needed again
Urgent Help Needed again
hassanzobeen




msg:4153241
 10:24 pm on Jun 15, 2010 (gmt 0)

Hello Every one,
As I am running a site but I am getting a little problem i.e.
When I use the URL e.g. http://www.example.com/ this URl automatically redirects to http://example.com/ but I want to use both domain prefixes i.e. http://www.example.com/ and http://example.com
here is my .htaccess Rewrite mod code please help me in this problem as soon as possible

.htaccess code


<IfModule mod_rewrite.c>
RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*) index.php?action=/$1

# Image Access Protection
# RewriteRule ^file/pic/photo/(.*)\.(.*)$ static/image.php?file=$1&ext=$2
</IfModule>

Please post the code I'll be very thankful to you

[edited by: jdMorgan at 12:17 am (utc) on Jun 16, 2010]
[edit reason] Please use example.com only [/edit]

 

g1smd




msg:4153249
 10:44 pm on Jun 15, 2010 (gmt 0)

Do you want to use the two for two different sites?

If so, then that is OK as per the HTTP specs, but more that a little bit unusual.

If you want to use them both for the same site, effectively serving two copies, then absolutely do not do that.

There are literally thousands of WebmasterWorld posts stretching back to at least 2005 on the dangers of Duplicate Content.

Use one to serve the content, and redirect the other.


In your post above, there are several important code changes to make:
- add the [L] flag to both rules,
- change the double
(.*)\.(.*) pattern to something else much more efficient, and
- add another RewriteCond to the first ruleset (and as the very first line) along the lines of
RewriteCond %{REQUEST_URI} !\.(jpe?g|gif|png|css|js)$ to massively speed up that rewrite.
jdMorgan




msg:4153290
 12:21 am on Jun 16, 2010 (gmt 0)

I don't recommend serving the same content from two hostnames, either. But if you want to be able to use both for some other reason, then you need to remove code, not add it. You may have a control panel setting or some code in another config file that is invoking the www to-non-www redirect. If so, I'm afraid it'll be up to you to find it, since only you have access to your server.

Jim

hassanzobeen




msg:4153412
 6:22 am on Jun 16, 2010 (gmt 0)

First of all thank you for your kind comment
but I dont know to coding of .htaccess file
can you please submit the proper code which I have to replace in the in the htaccess I'll be very thankful to you.
I request you to please submit the proper & full code which will be replace from the existing code

g1smd




msg:4153420
 6:42 am on Jun 16, 2010 (gmt 0)

I asked several questions above. Please answer those.

hassanzobeen




msg:4153425
 6:57 am on Jun 16, 2010 (gmt 0)

Yes Sir
I want to the two for two different sites & also I want to use them both for the same site, effectively serving two copies.

tangor




msg:4153429
 7:30 am on Jun 16, 2010 (gmt 0)

Sounds like SEO suicide to me. I'd go along, reluctantly, if each served DIFFERENT content. Looking at DUPLICATE CONTENT penalties.

jdMorgan




msg:4153558
 1:01 pm on Jun 16, 2010 (gmt 0)

Hassan,

Please note what I posted above:
if you want to be able to use both for some other reason, then you need to remove code, not add it.

We can't tell you what code to add, because you cannot fix this problem by adding code. You need to remove code.

Jim

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