Virtual directory / paths / URLs on website?
- Started
- Last post
- 15 Responses
- thismanslife
I've got pretty basic web hosting, so can't do anything too sophisticated... but I'd like to have more friendly URLs that I have currently. Eg. Right now, I have things like this:
thismanslife.co.uk/main.asp?cont......which I'd like to be:
thismanslife.co.uk/photography/
Is there anything I can do, using either ASP or PHP... like maybe, virtual include / file path stuff??
- acescence0
is your server running apache?
- thismanslife0
um... maybe?
- version30
find out
http://us2.php.net/phpinfo
- acescence0
it looks like you're on a windows IIS server. not my area of expertise, sorry. this sort of thing is trivial with apache and mod_rewrite, but a bit more tricky on a win server
- acescence0
basically what you want to search for is "URL rewriting"
- thismanslife0
Alrighty, thanks - I'll look into that...
- vaxorcist0
http://www.micronovae.com/ModRew…
$75 or $150 for something that's free in unix, so welcome to Windows!
.... there are free solutions that probably take more time as may have to compile them yourself, and turn into a sysadmin unless you already are a sysadmin....
Note that regular expressions require some thought, they're not insanely easy, but with this solution, you can easily move your stuff to unix without rewriting all your redirect scripts...
- vaxorcist0
this might work too.....
- thismanslife0
Ugh, I'm really not getting this. I have no access to the server itself besides the obvious FTP, to upload files. It's pretty basic hosting, apparently it lets me use the following:
"ASP, PHP, Perl, compiled CGI, ISAPI and SHTML scripting"Total novice here, I'm using very simple ASP (I know, I know...) to build page layouts for the site itself, just using includes etc. Beyond that, I don't really understand how I use the things you've linked here - would I need to be able to access / install things on the server itself to use these things?
- vaxorcist0
argh... you might be able to find a new host.
from the URL you list above, your code is in ASP, that means Windows..... and most windows hosts you rent space on won't allow you to install the stuff above....
if it's only includes, you can move to a Unix host, and use PHP and mod_rewrite, but you will have to rewrite your include statements.
Good luck, this is a pain at first, but may make sense after a while.... find a geek friend and buy a beer may be a good answer too... otherwise all this code can be an evil rabbit hole to fall into if you're not a coder at heart....
- thismanslife0
vaxorcist, many thanks :)
- acescence0
your host appears to offer linux as well, so just ask them to switch you over, use php includes instead (which seems like it would be a fairly quick conversion...?), then come back here and we'll set you up on mod_rewrite
- acescence0
mod_rewrite can also do other fun stuff like prevent image hotlinking, redirect direct image file links to a containing html page, and quick pseudo subdomains (subdomain.yourdomain.com) among other things.
- thismanslife0
Blimey - thanks for investigating!!
As it happens, I tried uploading a simple php page to my site as it is currently, and it gets served up correctly... does that mean I don't need to switch to Linux? Is mod_rewrite dependant on Linux or PHP (or both)?
PHPINFO()
System Windows NT IIS6120 5.2 build 3790
Virtual Directory Support enabled...Interesting?
- vaxorcist0
the issue is the webserver: Microsoft IIS, not PHP
mod_rewrite is dependant on Apache. Apache runs on Linux or Windows, but almost all hosts run it on Linux. I'd switch to Linux for this and other reasons.