d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > Web Server Pointer Locations
Add Reply New Topic New Poll
Member
Posts: 5,269
Joined: Oct 18 2006
Gold: 21,400.00
Jun 23 2015 03:32pm
I have my php file on the server at:

blahblah.com/xandumx/Programming/ApplicationA/test.php

I want the physical file there but I want a pointer in a different directory for:

blahblah.com/test.php

If someone uses either link, I want it to open the same php file. I tried a simple shortcut in my file, but that didn't work. I obviously do not want to maintain two copies of my program...
Member
Posts: 32,925
Joined: Jul 23 2006
Gold: 3,804.50
Jun 23 2015 05:38pm
have apache redirect it. or whatever software you're using to manage it.
Member
Posts: 13,578
Joined: Jul 27 2010
Gold: 2,285.00
Jun 23 2015 06:26pm
Can you create a link on the filesystem to redirect to that location?

e.g. if SERVER_ROOT is /srv/www and the actual filepath is /srv/www/xandumx/Programming/ApplicationA/test.php, something like this should do the trick:

ln -s /srv/www/xandumx/Programming/ApplicationA/test.php /srv/www/test.php
Member
Posts: 1,358
Joined: Dec 30 2012
Gold: 0.10
Jun 23 2015 06:29pm
put this in the .htaccess file in blahblah.com's document root

Code
RewriteEngine On
RewriteRule ^/xandumx/Programming/ApplicationA/(.*)$ http://blahblah.com/$1 [L,R=301]


This will rewrite any files in /xandumx/Programming/ApplicationA/

http://blahblah.com/xandumx/Programming/ApplicationA/index.php -> http://blahblah.com/index.php

http://blahblah.com/xandumx/Programming/ApplicationA/test.php -> http://blahblah.com/test.php

etc...

This post was edited by SelfTaught on Jun 23 2015 06:33pm
Go Back To Programming & Development Topic List
Add Reply New Topic New Poll