Aftershock
Aftershock

Reputation: 5351

Is it possible to alias a filename on an apache webserver?

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

Upvotes: 1

Views: 3554

Answers (2)

Taylor Leese
Taylor Leese

Reputation: 52330

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]

Upvotes: 0

Jordan S. Jones
Jordan S. Jones

Reputation: 13883

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

Upvotes: 4

Related Questions