Welcome to WebmasterWorld Guest from 54.226.241.8

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

301 redirect frustration

     

mgpapas

7:01 pm on Aug 30, 2006 (gmt 0)

10+ Year Member



Ok I'm going crazy I am trying to do what I keep reading everywhere is a simple procedure.
I want to redirect domain.co.uk/test.html to [otherdomain.com...] I'm running Apache/2.0.52 (CentOS)

I host 20+ domains on my server so I use virtual hosts configured like so.

<VirtualHost www.domain.co.uk>
DocumentRoot /home/domains/domain_co_uk
ServerName www.domain.co.uk
<Directory "/home/domains/domain_co_uk">
allow from all
Options +Indexes
</Directory>
</VirtualHost>

The first thing I tried was .htaccess like so

Redirect 301 /test.html [domain.com...]

and put in the domains root directory /home/domains/domain_co_uk

I even tried to redirect the entire domain using mod_rewrite but it seems the .htaccess file is totally ignored.

Next I tried

Redirect permanent /home/domains/domain_co_uk/test.html [domain.com...]

in the httpd.conf and restarted apache as instructed.

AGAIN nothing happened.

Is my server broke or what? I hope someone reads this and can tell me what I could possibly do to solve this I have googled this problem to death and can't find anything.

Caterham

7:24 pm on Aug 30, 2006 (gmt 0)

10+ Year Member



Next I tried

Redirect permanent /home/domains/domain_co_uk/test.html [domain.com...]

in the httpd.conf and restarted apache as instructed.


You must use an url-path, not a filename.

<VirtualHost www.domain.co.uk>
DocumentRoot /home/domains/domain_co_uk
ServerName www.domain.co.uk
[b] Redirect 301 /test.html http://www.otherdomain.com/test.php [/b]
<Directory "/home/domains/domain_co_uk">
allow from all
Options +Indexes
</Directory>
</VirtualHost>

mgpapas

8:25 pm on Aug 30, 2006 (gmt 0)

10+ Year Member



I'm not the religious type but god bless you it worked.
The problem I had was I wasn't putting the httpd.conf 301 redirect inside the <virtualhost>

Apache's instructions just say:

# Redirect allows you to tell clients about documents which used to exist in
# your server's namespace, but do not anymore. This allows you to tell the
# clients where to look for the relocated document.
# Example:
# Redirect permanent /foo http://www.example.com/bar

So based on that I just put

Redirect permanent /home/domains/domain_co_uk/test.html [domain.com...]

below there which of course didn't work.

I may seem like a total noob but all my other sites are php and a php 301 redirect is very simple.

 

Featured Threads

Hot Threads This Week

Hot Threads This Month