![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Expert Programmer
|
Apache Internal Redirect Help
Hi,
I've been stuck on this problem for about a year now. Say I have a directory named /foo containing HTML files I want to display. How can I internally redirect any requests for files at the root (/) directory to those files in the /foo directory? For example, if a request is made for http://www.mysite.com/page.html, how can I display the contents of http://www.mysite.com/foo/page.html without changing the URL in the user's browser? I've tried using .htaccess scripts to internally rewrite any requests, but for some reason this never works for the root directory; I always get a "500 Internal Server Error." Any help? Thanks. |
|
|
|
|
|
#2 |
|
Programming Guru
![]() ![]() ![]() |
Maybe a directory alias would work? I've never tried one for the root... but have several for other directories...
Edit your httpd.conf and make a directory alias, such as: Alias /alias/path/ "/real/path/" <Directory "/real/path"> Options Indexes MultiViews AllowOverride None Order allow,deny Allow from all </Directory> Then restart Apache...
__________________
http://jasonpowers.net "There are a thousand hacking at the branches of evil to one who is striking at the root." |
|
|
|
|
|
#3 |
|
Expert Programmer
|
I don't have access to an httpd.conf file because I'm sharing hosting. Is there some way to do this in a .htaccess file?
|
|
|
|
|
|
#4 |
|
Programming Guru
![]() ![]() ![]() |
This works for me: In the httpd root directory, make a .htaccess file with the redirection in it...
Redirect /oldfile http://somewhere.com/some/dir/newfile BUT, it changes the URL in the browser. Not sure off hand how to keep it from changing that.
__________________
http://jasonpowers.net "There are a thousand hacking at the branches of evil to one who is striking at the root." |
|
|
|
|
|
#5 |
|
Expert Programmer
|
Thanks, although what I'm really looking for is an internal redirect...
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|