Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Redirecting urls

Status
Not open for further replies.

aristos

Technical User
Dec 12, 2000
50
US
Hell, folks. I've been looking for an answer to this, and I think that mod_rewrite has what I need, but I'm damned if I can make it work. If mod_rewrite is *not* the answer, can someone please point me in the "write" direction (ok, bad pun...)

I have a website, and the home directory is /home/site/public_html/
I have a test site, test.site.com, and the home directory is /home/site_test/public_html/

I only have one IP for the whole of so I want people to be able to type (from the outside of our network) and have the server pull up the pages in /home/site_test/public_html

I have a gut feeling that this can be done, but I am finished pulling hair and asking you fine folks for an answer.

recap: type into the browser, the web server serves pages from (internal) /home/site_test/public_html instead of /home/site/public_html

Possible? Hm???

Thanks, all, inadvance.

Mike

Mike
<this space for rent>
 
A simple [tt]Alias[/tt] should do what you want:
[tt]Alias /test /home/site_test/public_html[/tt]

//Daniel
 
Well, I broke down and created a virtual host by port, so the user goes to port 8080 and it loads the test version of the site. Not as elegant as I wanted (which was to go to test.site.com) but it works.

Thanks for the help :)

Mike
<this space for rent>
 
Ok I've sorted it ... and tested it on dev machine here.

1) Create your test directory cd /home; mkdir -p site_test/public_html; chmod/chown as necessary
2) place a index .html document there to test with
3) vi /etc/httpd/conf/httpd.conf and add the Alias as I did below the icons alias.


# Note that if you include a trailing / on fakename then the server will
# require it to be present in the URL. So &quot;/icons&quot; isn't aliased in this
# example, only &quot;/icons/&quot;..
#
Alias /icons/ &quot;/var/
<Directory &quot;/var/ Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>

Alias /test/ &quot;/home/site_test/public_html/&quot;

<Directory &quot;/home/site_test/public_html&quot;>
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>


4) restart httpd with: service httpd restart
and go to
Or use your real url/test/

Should work fine ?

Good luck
Laurie.
 
Thanks, Laurie. I'll check it out.

Mike
Will BF1942 for food...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top