views:

109

answers:

2

Hi,

I would like to make e.g. www.address.com/u.exe equal to www.address.com/serverfile.php or pl?

Is it possible? So if someone types www.address.com/u.exe should get servefile.php...

Thanks for showing the right direction..

This seems to work. RewriteEngine on also had to be added.

I had to change .htaccess file

RewriteEngine on
RewriteRule ^u\.exe$ serverfile.php
+3  A: 

Yes. That's what the mod_alias Apache module does for you: http://httpd.apache.org/docs/2.2/mod/mod_alias.html#alias

Jordan S. Jones
Are you sure I can "alias" a filename using mod_alias? So far I can see this can be done through mod_rewrite only....
Aftershock
Yes, I am quite positive as this is how I have things set up on some sites I maintain. Even though the documentation doesn't say it, you can alias a file. For example: alias /u.exe /file/system/path/serverfile.php
Jordan S. Jones
A: 

Yes, it's possible with mod_rewrite like below.

RewriteRule ^/u.exe$ /serverfile.php [L]

Or below if you want to display serverfile.php (via a redirect).

RewriteRule ^/u.exe$ /serverfile.php [RL]
Taylor Leese
almost correct....
Aftershock
what was wrong with it?
Taylor Leese
oh nevermind, i see you added RewriteEngine On -- i assumed that was implied :-)
Taylor Leese