LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 12-30-2003, 12:17 AM   #1
webmeister
LQ Newbie
 
Registered: Dec 2003
Posts: 2

Rep: Reputation: 0
mod_rewrite & regex problem


hi, i'm trying to get the following to work in my .htaccess ... this regex thing is making my brain bleed 8-)

RewriteRule (.*) /%(HTTP_HOST)/$1

i have 3 domains all aliased to the same virtual server. i would like the rewriterule to direct apache to the proper directory and use the files in it without having to write a new rule for each domain... the regex rule should work to any depth of subdirs on any kind of file... example mappings would be like...

domain1.com
domain2.com/testdir1
domain3.com/testdir2/file.html

would go lookup files in

/var/www/html/domain1.com/
/var/www/html/domain2.com/testdir1
/var/www/html/domain3.com/testdir2/file.html

any assistance would be very much appreciated

happy new year!
bill bush
 
Old 12-30-2003, 08:19 AM   #2
ugob
Member
 
Registered: Nov 2003
Distribution: RH, Fedora, Debian, Knoppix
Posts: 436

Rep: Reputation: 31
This looks more like a job for virtual hosts more than mod_rewrite.

http://www.google.com/search?q=apach...utf-8&oe=utf-8

http://httpd.apache.org/docs/vhosts/name-based.html
 
Old 12-30-2003, 12:19 PM   #3
webmeister
LQ Newbie
 
Registered: Dec 2003
Posts: 2

Original Poster
Rep: Reputation: 0
u right about that ugob... that's how i do it on my home server in the httpd.conf file... unfortunately i'm trying to do this under ensim on a shared server. i have no access to httpd.conf and if i create a virtual server for each domain under ensim it's a separate user account and i cannot control what the directories are and a bunch of other crap you don't think about till you actually try to do it muahahaha... the best i could do was get the sysadmin to give me mod_rewrite... so i'll just take the performance hit .htaccess mod_rewrite incurrs until a better solution comes along...
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
regex problem with sed ta0kira Programming 7 06-20-2005 01:33 AM
Mod_rewrite install problem gobrien Linux - Newbie 1 06-04-2005 05:30 PM
mod_rewrite problem jfall Programming 1 02-22-2005 08:05 PM
Suse 9.1 Pro & htaccess file: mod_rewrite not loading sorenson2743 SUSE / openSUSE 2 12-04-2004 12:36 AM
Apache & mod_rewrite Modify Linux - Software 0 12-12-2003 09:25 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:48 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration