LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-06-2008, 05:50 AM   #1
chrille112
LQ Newbie
 
Registered: Apr 2007
Posts: 22

Rep: Reputation: 15
Unhappy mod_rewrite full path


I'm trying to rewrite this: http://test.com/s/blah.html
to my script: /var/www/script.php?data={blah.html}

This is my rewrite:
RewriteRule s/(.*)$ /var/www/script.php?data={$1}

But it doesn't work. Apache tries to append /var/www to my home path:
File does not exist: /home/test/public_html/var/www/script.php

How do I solve this?
 
Old 03-06-2008, 06:04 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974
well that's technically correct, I would suggest that you should actually be structuring your files in a more suitable manner? why do you have two locations for files? you could fudge this with directory alias or symlinks, but it'd be a fudge for sure.
 
Old 03-06-2008, 06:17 AM   #3
chrille112
LQ Newbie
 
Registered: Apr 2007
Posts: 22

Original Poster
Rep: Reputation: 15
The idea is that I should be able to use the "script.php" file on multiple domains, I want all of them to rewrite to that file and handle the content.

That's why I have the script file on a different location. I know it could be solved by linking file, but I would prefer if it's possible to do it only with htaccess.

Any idas?
 
Old 03-06-2008, 06:20 AM   #4
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974
well that'd be an alias then, in the same way that cgi-bin directories are generally aliased into the relative space. if you define that at a global level then any vhost should inherit it.
 
Old 03-06-2008, 06:21 AM   #5
chrille112
LQ Newbie
 
Registered: Apr 2007
Posts: 22

Original Poster
Rep: Reputation: 15
Ok. How do I do that?
 
Old 03-06-2008, 06:23 AM   #6
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974
http://httpd.apache.org/docs/2.2/mod/mod_alias.html
 
Old 03-06-2008, 06:49 AM   #7
chrille112
LQ Newbie
 
Registered: Apr 2007
Posts: 22

Original Poster
Rep: Reputation: 15
Perfect, just what I wanted. Thank you very much
 
  


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
Full Path Verbal Kint Linux - General 7 01-30-2008 09:34 PM
mod_rewrite for rewriting proxied path GSMD Linux - Server 0 02-28-2007 08:01 AM
full path of a file ttilt Linux - General 1 11-08-2005 06:02 PM
Need to specify the full URL path.. Why? soichih Linux - Networking 3 07-31-2004 08:37 AM
Full Path problems chedmaster Linux - Newbie 1 06-26-2003 10:24 AM


All times are GMT -5. The time now is 08:14 AM.

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