Welcome to WebmasterWorld Guest from 54.159.12.17

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

Urgent Help Needed again

Urgent Help Needed again

     

hassanzobeen

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

5+ Year Member



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

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

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



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

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

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



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

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

5+ Year Member



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

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

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



I asked several questions above. Please answer those.

hassanzobeen

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

5+ Year Member



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

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

WebmasterWorld Senior Member tangor is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month



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

jdMorgan

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

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



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
 

Featured Threads

Hot Threads This Week

Hot Threads This Month