Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > Linux Forums > Programming/Scripts

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 9th August 2007, 15:43
David91 David91 is offline
Junior Member
 
Join Date: Aug 2007
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Thumbs down redirecting with .htaccess?

Hello,

im new here and i have no skill in programming at all, im simply doing this to get my website working correctally.

The Full story:
My website is www.seriesoftubes.co.uk/david but because if the way it is configured and they way my domain (davidoboyle.co.uk) is set up and the way that the we host is set up i cant link my domain to my webspace. so
instead they have linked it to the main page. which is seriesoftubes.co.uk (which is a friends website/main page) My friend has given me a folder in his webspace to use as a blog and seen as i cant direct my domain to my folder/blog (because of an issue i cant fix) i am looking for a script/code to redirect people who imput davidoboyle.co.uk into my blog/folder. i know that this can be done using htaccess but i am useless at coding an unfortunatly i cannot fix it. My friend (the owner of the website) thought of this code:

Quote:
Order deny,allow
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.[^.]+\.www\.davidoboyle\.co\.uk$
RewriteRule ^(.+) %{HTTP_HOST}$1 [C]
RewriteRule ^www\.([^.]+)\.www\.davidoboyle\.co\.uk(.*) /david$1$2
although it failed to work and gave the user an internal server error (500)
So im looking for a peice of code to make this work. any ideas?

just to recap:
im looking for a peice of code to redirect people who enter davidoboyle.co.uk into their brower to seriesoftubes.co.uk/david

Thanks for any help offered

Last edited by David91; 9th August 2007 at 16:01.
Reply With Quote
Sponsored Links
  #2  
Old 9th August 2007, 16:50
geekman geekman is offline
Member
 
Join Date: Sep 2006
Location: Sydney, Australia
Posts: 56
Thanks: 1
Thanked 10 Times in 10 Posts
Send a message via ICQ to geekman Send a message via MSN to geekman
Default

Why not just create an index.html page at davidoboyle.co.uk like so:
Code:
<html>
    <head>
        <title>Redirecting...</title>
        <META HTTP-EQUIV="Refresh" CONTENT="0; URL=http://seriesoftubes.co.uk/david">
    </head>
    <body>
        <a href="http://seriesoftubes.co.uk/david">If you are not redirected click here.</a<
</html>
Should work fine for you.
Thanks.
Reply With Quote
  #3  
Old 9th August 2007, 16:54
David91 David91 is offline
Junior Member
 
Join Date: Aug 2007
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default

thing is that davidoboyle.co.uk is only a domain, there is no hosting on it, so all the hosting is on seriesoftubes.co.uk so unfortunatly i cant do as youve described, thanks for the help though.

Any other ideas?
Reply With Quote
  #4  
Old 10th August 2007, 16:56
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,741 Times in 2,575 Posts
Default

Try something like this:

Code:
RewriteEngine on
RewriteCond   %{HTTP_HOST}                 ^www\.[^.]+\.davidoboyle\.co\.uk$
RewriteRule   ^(/~.+)         http://www.seriesoftubes.co.uk/david/$1 [R,L]
__________________
Falko
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
  #5  
Old 11th August 2007, 19:25
David91 David91 is offline
Junior Member
 
Join Date: Aug 2007
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default

thanks for all the help.

i tried your code with our server and nothing happened. it doesnt redirect me and it doent destroy the server with a 500 error. i then added the line

Quote:
Order deny,allow
to the top like the other code has and it gave us a 500 error again. whats is this code used for? is it incompatable with our server or isnt it written properly?
Reply With Quote
  #6  
Old 12th August 2007, 14:10
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,741 Times in 2,575 Posts
Default

Are there any errors in Apache's error log?
__________________
Falko
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
  #7  
Old 12th August 2007, 14:26
David91 David91 is offline
Junior Member
 
Join Date: Aug 2007
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default

sorry for not posting this before, i found them and i just forgot.

here is it

Quote:
[Sun Aug 12 12:33:14 2007] [alert] [client xx.xx.xxx.xx] /home/fhlinux166/s/seriesoftubes.co.uk/user/htdocs/.htaccess: order not allowed here
Reply With Quote
  #8  
Old 13th August 2007, 17:31
David91 David91 is offline
Junior Member
 
Join Date: Aug 2007
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default

bump (sorry)
Reply With Quote
  #9  
Old 13th August 2007, 19:19
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,741 Times in 2,575 Posts
Default

Please remove the order line from .htaccess. Then direct your browser to www.davidoboyle.co.uk (not davidoboyle.co.uk). What happens?
__________________
Falko
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
  #10  
Old 13th August 2007, 21:49
David91 David91 is offline
Junior Member
 
Join Date: Aug 2007
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
 
Default

when i remove the "order deny,allow" line and enter www.davidoboyle.co.uk into my browser it just goes to the main page (the same location that seriesoftubes.co.uk points to)
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
.htaccess Liac Server Operation 15 20th June 2007 15:19
wordpress MU and ISPconfig .htaccess isues palkat General 4 18th October 2006 11:57
.htaccess login challenge broken with mod_rewrite ozonblue Installation/Configuration 2 13th September 2006 10:09
.htaccess never executed galmiche Server Operation 2 4th June 2006 21:44
No .htaccess in automatic backup? tron Installation/Configuration 3 22nd March 2006 18:03


All times are GMT +2. The time now is 19:43.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.