Pyrozz Posted October 26, 2008 Share Posted October 26, 2008 So the website I am working on displays information based on the url. For starters, the sub domain determines the user name. For example: pyrozz.mysite.com The account "pyrozz" will be pulled from a database and information will be displayed. This is handled in the main index.php file. The next part (which is where I have a question about) is the directory portion of it... So now each user has imaginary directories within their account. Let's say pyrozz has "my_photos." So that would be pyrozz.mysite.com/my_photos. Here's the thing, my_photos doesn't exist, nor do I want it to exist, I just want a php script to display information based on what it says. So my solution is using the 404 file. In my error page (404.php) it looks at the URL and figures out what imaginary directory to display. Then it will use include etc... Whatever. I guess that was an excessive explanation, but my question is, is there a better way to do this? Is there some way to have a script handle ALL URL requests? Link to comment https://forums.phpfreaks.com/topic/130190-solved-using-404-file-to-direct-requests-a-better-way/ Share on other sites More sharing options...
Pyrozz Posted October 27, 2008 Author Share Posted October 27, 2008 I would edit instead reply, but I guess that feature isn't availabe in WAP browsing... Well I did figure it out, as I suspected you can do this with the .htaccess file with "rewrite engine" ...And how convinient that the rule set uses reg exp!! I just learned regexp syntax, so this is just awesome. Link to comment https://forums.phpfreaks.com/topic/130190-solved-using-404-file-to-direct-requests-a-better-way/#findComment-675276 Share on other sites More sharing options...
DarkWater Posted October 27, 2008 Share Posted October 27, 2008 Yeah, you'd use mod_rewrite for this. Link to comment https://forums.phpfreaks.com/topic/130190-solved-using-404-file-to-direct-requests-a-better-way/#findComment-675279 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.