Forum Moderators: phranque

Message Too Old, No Replies

help with .htaccess

         

Leelaw

4:33 am on Mar 8, 2015 (gmt 0)

10+ Year Member



currently I have Example.com pointing to the correct index page but when I press on a link it reverts to TestExample.com/page.php

What I want to do is change how the main domain is displayed EG: Test.Example.com/thispage.php shows up as Example.com/thispage.php so every page after the / remains the same the only change is that Example.com is displayed and not TestExample.com is that clear enough ?

TestExample.com should not be seen at all

Can someone please help me with what that .htaccess code should be ?

ps: can I also include removing the WWW to a non-www in that code

lucy24

5:54 am on Mar 8, 2015 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



is that clear enough ?

Er... Not quite. I understand that you're talking about two different domain names. But there's one crucial bit of information missing: What do the index-page links point to? All the htaccess changes in the world at example.com won't help if the user has already been sent to example.org.

As for the with/without www: That's your domain-name canonicalization redirect. This question gets asked about once a week-- let's say, conservatively, once a month. And this forum has been running for about 15 years. So do the math :) and try a Forums search.

Pro tip: Once you get to search results, it will say something like "site:webmasterworld.com". At this point you can edit it to say "webmasterworld.com/apache" to constrain results to a particular subforum.

not2easy

6:50 am on Mar 8, 2015 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



Or you could start with a visit to the Charter and Library which have most of the bases covered for self help.

Are you trying to use two domains or is the actual format
test.example.com
and not really
testexample.com
?

phranque

9:28 am on Mar 8, 2015 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



welcome to WebmasterWorld, Leelaw!


when I press on a link it reverts to TestExample.com/page.php

please try using the Live HTTP Headers FF plugin or some other tool to Check HTTP Response Headers:
http://freetools.webmasterworld.com/tools/fetch-header/ [freetools.webmasterworld.com]

report the request/response status chain.


also show us an exemplified version of the mod_alias/mod_rewrite directives in your .htaccess file and your server configuration.

Leelaw

9:50 am on Mar 8, 2015 (gmt 0)

10+ Year Member



Really it's not straight forward ?

I have a domain MyDomain.com

the website has been put together on a free server FreeServer.com

the DNS for MyDomain.com is pointing to that server, all I want to do is rather than create another subdomain, have MyDomain.com displayed in the Url rather than FreeServer.com

with all the links remaining in place so FreeServer.com/page1.php is displayed as MyDomain.com/page1.php the only bit that's changing is the front bit, with all subsequent links remaining the same after the /

That includes rollovers, so in essence everything appears to be on MyDomain.com

[edited by: Leelaw at 10:04 am (utc) on Mar 8, 2015]

Leelaw

9:54 am on Mar 8, 2015 (gmt 0)

10+ Year Member



And yes I realise canonisation of a domain name is a usual request but I was wondering how to add them together, what order and if there would be any problems

phranque

10:21 am on Mar 8, 2015 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



have MyDomain.com displayed in the Url rather than FreeServer.com

once the link is clicked, you can't fix that problem on your live server because the request went elsewhere.
it's not an apache problem.
the problem is with the content being served which is referring to your development server's hostname.
perhaps there is a hostname setting in the configuration for your CMS.

Leelaw

11:45 am on Mar 8, 2015 (gmt 0)

10+ Year Member



I feel pretty sure there is an .htaccess solution to this problem ?

Clocked link on rollover that displays MyDomain.com rather than FreeServer.com and when you click on the link it goes to the page and displays MyDomain.com/chosenpage.php in the Url address bar..

that seems like a simple thing for .htaccess to acheive, just don't know what the code would be ?

phranque

5:05 pm on Mar 8, 2015 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



please try using the Live HTTP Headers FF plugin or some other tool to Check HTTP Response Headers:
http://freetools.webmasterworld.com/tools/fetch-header/ [freetools.webmasterworld.com]

report the request/response status chain.

lucy24

7:29 pm on Mar 8, 2015 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I feel pretty sure there is an .htaccess solution to this problem ?

Seems like I read an answer to this question not long ago.

:: shuffling papers ::

What do the index-page links point to? All the htaccess changes in the world at example.com won't help if the user has already been sent to example.org.


Oops, my bad, I didn't read that. I wrote it. I'm still waiting for an answer to the key question, though.

All this is assuming that "FreeServer.com" (made-up name, I hope) actually allows users to have their own domain names. If the "Free" name means that you're not paying, then there is a real possibility your problem will only be answered by coughing up $10/month for decent hosting.