Forum Moderators: phranque
i want to map to two diffrent files in the same directory according to Alias provided
So if the the user types the url as [zz.zz.zzz.zzz...]
i must go to file first.html ie ie [zz.zz.zzz.zzz...]
and if the user types the url as [zz.zz.zzz.zzz...]
i must go to file second.html ie [zz.zz.zzz.zzz...]
what is happening in current situation is that whatever be the URL of the above two i am directed to second.html
I assume that DirectoryIndex property is causing it but i am not sure
I havent touched httpd.conf file and all the default settings are maintained so DocumentRoot has not been changed its still /var/www/html
My query is
with above scenarion what am i supposed to do to my conf file in /etc/conf.d/ so that everything works right?
I have tried using Redirect permanent and it works fine but i dont want to pass the absolute url which is the case in Redirect
like
Redirect permanent /tt [localhost:9001...] <==i dont want to pass this URL with PORT visible
Redirect permanent /pp [localhost:9001...]
Can mapping to two different files which are in the same directory can be done using aliases?
Following is my conf file in /etc/conf.d/ direcory
Alias /tt "/home/site/"
<Directory "/home/site/">
DirectoryIndex first.html
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
Alias /pp "/home/site/"
<Directory "/home/site/">
DirectoryIndex second.html
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
thanks
in advance
Ramesh
I couldnt fix the problem with Alias ofcourse
but as i used URL rewriting
I used this simple URL rewriting
RewriteEngine on
RewriteRule ^/pp$ /pp/second.html [R]
RewriteRule ^/tt$ /tt/first.html [R]
in my conf file
and this solved the problem
hope this helps somebody like me!
thanks
Welcome to WebmasterWorld!
I'm glad you got it figured out. It was confusing that you seemed to want to use an 'alias', which is a very different thing from a rewrite.
Note that there are two basic functions of mod_rewrite: URL redirection, and URL rewriting. The first is an external function which involves the client (e.g. browser), while the second takes place entirely within the server.
Rewrite:
RewriteEngine on
RewriteRule ^/pp$ /pp/second.html [L]
RewriteRule ^/tt$ /tt/first.html [L]
Redirect:
RewriteEngine on
RewriteRule ^/pp$ http://www.example.com/pp/second.html [R=301,L]
RewriteRule ^/tt$ http://www.example.com/tt/first.html [R=301,L]
Jim