Apache Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsSystem AdministrationApache Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
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  
Old April 20th, 2008, 06:05 AM
imrie imrie is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2007
Posts: 219 imrie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 Days 20 h 57 m 16 sec
Reputation Power: 1
Arrow .htaccess mod_rewrite subdomain.

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,

Reply With Quote
  #2  
Old April 20th, 2008, 10:34 AM
lnxgeek lnxgeek is offline
I AM A GOLDEN GOD
Dev Shed God (5000 - 5499 posts)
 
Join Date: Apr 2003
Location: cannot find symbol: method showLocation()
Posts: 5,278 lnxgeek User rank is Colonel (50000 - 60000 Reputation Level)lnxgeek User rank is Colonel (50000 - 60000 Reputation Level)lnxgeek User rank is Colonel (50000 - 60000 Reputation Level)lnxgeek User rank is Colonel (50000 - 60000 Reputation Level)lnxgeek User rank is Colonel (50000 - 60000 Reputation Level)lnxgeek User rank is Colonel (50000 - 60000 Reputation Level)lnxgeek User rank is Colonel (50000 - 60000 Reputation Level)lnxgeek User rank is Colonel (50000 - 60000 Reputation Level)lnxgeek User rank is Colonel (50000 - 60000 Reputation Level)lnxgeek User rank is Colonel (50000 - 60000 Reputation Level)lnxgeek User rank is Colonel (50000 - 60000 Reputation Level)lnxgeek User rank is Colonel (50000 - 60000 Reputation Level) 
Time spent in forums: 1 Month 1 Day 21 h 17 m 36 sec
Reputation Power: 564
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.

Reply With Quote
  #3  
Old April 20th, 2008, 10:58 AM
imrie imrie is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2007
Posts: 219 imrie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 Days 20 h 57 m 16 sec
Reputation Power: 1
Quote:
Originally Posted by lnxgeek
Is that your 'real' file?

The reason I ask:
Code:
RewriteRule ^(.*)$ http://http://www.website.com/~directory/ [R=301,L]


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?

Reply With Quote
  #4  
Old April 20th, 2008, 01:03 PM
imrie imrie is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2007
Posts: 219 imrie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 Days 20 h 57 m 16 sec
Reputation Power: 1
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

Reply With Quote
  #5  
Old April 21st, 2008, 07:45 AM
jharnois's Avatar
jharnois jharnois is offline
mod_dev_shed
Dev Shed God 19th Plane (14000 - 14499 posts)
 
Join Date: Sep 2002
Location: Atlanta, GA
Posts: 14,124 jharnois User rank is Brigadier General (60000 - 70000 Reputation Level)jharnois User rank is Brigadier General (60000 - 70000 Reputation Level)jharnois User rank is Brigadier General (60000 - 70000 Reputation Level)jharnois User rank is Brigadier General (60000 - 70000 Reputation Level)jharnois User rank is Brigadier General (60000 - 70000 Reputation Level)jharnois User rank is Brigadier General (60000 - 70000 Reputation Level)jharnois User rank is Brigadier General (60000 - 70000 Reputation Level)jharnois User rank is Brigadier General (60000 - 70000 Reputation Level)jharnois User rank is Brigadier General (60000 - 70000 Reputation Level)jharnois User rank is Brigadier General (60000 - 70000 Reputation Level)jharnois User rank is Brigadier General (60000 - 70000 Reputation Level)jharnois User rank is Brigadier General (60000 - 70000 Reputation Level)jharnois User rank is Brigadier General (60000 - 70000 Reputation Level) 
Time spent in forums: 1 Month 1 Week 1 Day 10 h 58 m 38 sec
Reputation Power: 717
Quote:
Originally Posted by imrie
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
That means you cannot use the Options directive in your .htaccess file. Hopefully the Options required to use mod_rewrite are already enabled.

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.

Reply With Quote
  #6  
Old April 22nd, 2008, 12:13 PM
imrie imrie is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2007
Posts: 219 imrie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 Days 20 h 57 m 16 sec
Reputation Power: 1
Arrow

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,

Reply With Quote
  #7  
Old April 24th, 2008, 01:48 PM
jharnois's Avatar
jharnois jharnois is offline
mod_dev_shed
Dev Shed God 19th Plane (14000 - 14499 posts)
 
Join Date: Sep 2002
Location: Atlanta, GA
Posts: 14,124 jharnois User rank is Brigadier General (60000 - 70000 Reputation Level)jharnois User rank is Brigadier General (60000 - 70000 Reputation Level)jharnois User rank is Brigadier General (60000 - 70000 Reputation Level)jharnois User rank is Brigadier General (60000 - 70000 Reputation Level)jharnois User rank is Brigadier General (60000 - 70000 Reputation Level)jharnois User rank is Brigadier General (60000 - 70000 Reputation Level)jharnois User rank is Brigadier General (60000 - 70000 Reputation Level)jharnois User rank is Brigadier General (60000 - 70000 Reputation Level)jharnois User rank is Brigadier General (60000 - 70000 Reputation Level)jharnois User rank is Brigadier General (60000 - 70000 Reputation Level)jharnois User rank is Brigadier General (60000 - 70000 Reputation Level)jharnois User rank is Brigadier General (60000 - 70000 Reputation Level)jharnois User rank is Brigadier General (60000 - 70000 Reputation Level) 
Time spent in forums: 1 Month 1 Week 1 Day 10 h 58 m 38 sec
Reputation Power: 717
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.

Reply With Quote
Reply

Viewing: Dev Shed ForumsSystem AdministrationApache Development > .htaccess mod_rewrite subdomain.


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

 Free IT White Papers!
 
Accelerating Trading Partner Performance
One in five. That's how many partner transactions have at least one error. That is an amazing statistic, particularly given the extraordinary leaps in innovation across the global supply chain during the past two decades. Download this white paper to learn more.

 
Competing on Analytics
This Tech Analysis is designed to help identify characteristics shared by analytics competitors, and includes information about 32 organizations that have made a commitment to quantitative, fact-based analysis.

 
Cost Effective Scaling with Virtualization and Coyote Point Systems
An overview of the industry trend toward virtualization, how server consolidation has increased the importance of application uptime and the steps being taken to integrate load balancing technology with virtualized servers.

 
Five Checkpoints to Implementing IP Telephony
Implementation planning for IP PBX software and IP telephony has become vital as businesses replace discontinued legacy PBX phone systems. This informative whitepaper outlines five "checkpoints" for any implementation plan that will help make IP communications a successful proposition.

 
Hosted Email Security: Staying Ahead of New Threats
In the last two years, email has become a fierce battleground between the nefarious forces of spam and malware, and the heroes of messaging protection. The spam volumes increased alarmingly every month, bringing clever new forms of phishing and virus propagation attacks.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway