Loans - Car Insurance - Problem Mortgage - Credit Cards - Homeowner Loan

PDA

View Full Version : .htaccess addon domains


blueuniverse
Oct 11th 2004, 11:47 am
I've got a few domains set up as addon domains on my website, but they can still be accessed by going to www.mynormaldomain.com/mydirectory/ (http://www.mynormaldomain.com/mydirectory/) instead of having to go to www.myaddondomain.com (http://www.myaddondomain.com)

What I need basically is a 301 redirect, for those pages in www.mynormaldomain.com/mydirectory/ (http://www.mynormaldomain.com/mydirectory/) to redirect to www.myaddondomain.com (http://www.myaddondomain.com)

How would I go about this?

Spyware Remover
Oct 11th 2004, 12:16 pm
Hope this helps:

301 Redirect
301 redirect is the most efficient and Search Engine Friendly method for webpage redirection. It's not that hard to implement and it should preserve your search engine rankings for that particular page. If you have to change file names or move pages around, it's the safest option. The code "301" is interpreted as "moved permanently".

You can Test your redirection with Search Engine Friendly Redirect Checker

Below are a Couple of methods to implement URL Redirection



How to Redirect in PHP
<?
Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: http://www.new-url.com" );
?>


How to Redirect in ASP
<%@ Language=VBScript %>
<%
Response.Status="301 Moved Permanently" Response.AddHeader "Location", " http://www.new-url.com"
>


How to Redirect in ASP .NET
<script runat="server">
private void Page_Load(object sender, System.EventArgs e)
{
Response.Status = "301 Moved Permanently";
Response.AddHeader("Location","http://www.new-url.com");
}
</script>


How to Redirect in ColdFusion
<.cfheader statuscode="301" statustext="Moved permanently">
<.cfheader name="Location" value="http://www.new-url.com">


How to Redirect with htaccess
Create a .htaccess file (if does not exists) in your root directory.
Redirect permanent / http://www.new-url.com

blueuniverse
Oct 11th 2004, 12:19 pm
Meant 301, sorry about that. Would .htaccess have any complications because of the addon domains and subdirectories?

Spyware Remover
Oct 11th 2004, 12:34 pm
You would have to try it out and see. I would think it would NOT have any complications because the .htaccess file is just a file of indivdual commands.

AJ

TwisterMc
Oct 11th 2004, 2:05 pm
That should work, however... why are people accessing your site at http://www.mynormaldomain.com/mydirectory? If you don't tell anyone, why would they go there?

blueuniverse
Oct 12th 2004, 9:23 am
Because, I already have a few links that went there, from when I was asking for reviews in the dev stages, and I get about 5 or so uniques a day from it now. :S

I suppose it will die out eventually, but for now, this will be the solution.

TwisterMc
Oct 12th 2004, 11:00 am
did it work? I'm very interested.

blueuniverse
Oct 12th 2004, 11:49 pm
I get the error, redirection limit for this url exceeded when attempting to go to the address of the addon domain.

TwisterMc
Oct 13th 2004, 9:54 am
it's looping. Might wanna contact your host and see if they have any ideas.

blueuniverse
Oct 13th 2004, 10:54 am
Yeah I know. I will try and contact my host about it.

TwisterMc
Oct 13th 2004, 11:52 am
Keep me informed though. That's a good issue.

blueuniverse
Oct 14th 2004, 8:20 am
It is, seems like there is no solution though. I've asked my host now, and they said that there isn't one.

If anybody does find a solution, I'd be very grateful to hear it.

TwisterMc
Oct 14th 2004, 11:13 am
I'll ask around.

blueuniverse
Oct 15th 2004, 8:54 am
Thanks, I will too

TwisterMc
Nov 24th 2004, 7:06 am
I never found an answer, did you? Now I wanna do this too and I'm not sure how. ;)

blueuniverse
Nov 24th 2004, 8:42 am
No, fraid not. Did ask, but I never got any answers that worked, all of them made it just bounce between the addon domain and the actual domain until it got confused and gave up.

TwisterMc
Nov 24th 2004, 8:46 am
Yea I get that to. I'll end up creating a new directory and copying the files in there. :rolleyes: It works at least.