|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
|
|
#1
|
|||
|
|||
|
Hello,
I am trying to do the following - whatever.website.com/index.html to redirect to website.com/whatever/index.html I have been reading the following - http://forums.digitalpoint.com/showthread.php?t=27020 Code:
Options +FollowSymLinks
Options +SymlinksIfOwnerMatch
RewriteEngine on
RewriteCond %{HTTP_HOST} ^directory.website.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.directory.website.com$
RewriteRule ^(.*)$ http://http://www.website.com/~directory/ [R=301,L]
However this just shows a 404 error, can you see a problem with this code? also, how would i change the script so any subdomain will redirect to the accompanying directory? Thanks very much, |
|
#2
|
|||
|
|||
|
Is that your 'real' file?
The reason I ask: Code:
RewriteRule ^(.*)$ http://http://www.website.com/~directory/ [R=301,L]
__________________
BookMooch.com : Give books away. Get books you want. |
|
#3
|
|||
|
|||
|
Quote:
Ha, yes that is my 'real' file and i was just dumb. Although, i still get a 404 error going to the subdomain and a 500 error when accessing my root site. Any ideas? |
|
#4
|
|||
|
|||
|
The error log says the error is -
Code:
[Sun Apr 20 16:56:00 2008] [alert] [client IP] /path/htdocs/.htaccess: Options not allowed here Thanks |
|
#5
|
||||
|
||||
|
Quote:
Have you made any attempt to understand what that rewrite (redirect, really) does? Do you have a folder named ~directory in your DocumentRoot? or do you have user directories setup and a directory user?
__________________
# Jeremy Explain your problem instead of asking how to do what you decided was the solution. |
|
#6
|
|||
|
|||
|
Hello,
Thanks for the reply, i have removed the options directives from the file and now no longer receive a 500 error. However, it still shows a 404 error. This is the current file - Code:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^cpg1412.mysimtractor.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.cpg1412.mysimtractor.com$
RewriteRule ^(.*)$ http://www.mysimtractor.com/cpg1412/ [R=301,L]
URL to directory - http://www.mysimtractor.com/cpg1412 URL to subdomain - http://www.cpg1412.mysimtractor.com ^^^ The above urls are to the directory, and yes the re-direct directory does exist and functional. Thanks, |
|
#7
|
||||
|
||||
|
I'm getting a "Server Not Found" error when I try to get to cpg1412.mysimtractor.com, and that's not the same a s "404 Not Found" error. However, Internet Explorer may show a "Server Not Found" as a "404 Not Found", or it may just say something like "Page Not Found," if friendly error pages are turned on :sigh:
Server Not Found means cpg1412.mysimtractor.com has no DNS entry. You have to have a DNS entry to point cpg1412.mysimtractor.com to the same IP address that mysimtractor.com points to in order for the rewrite to take over. |
![]() |
| Viewing: Dev Shed Forums > System Administration > Apache Development > .htaccess mod_rewrite subdomain. |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|