| |||||||
| Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics. |
![]() |
| | LinkBack | Thread Tools |
| | #1 (permalink) |
| An American Soldier ![]() | Creating a virtual URL i need to fiqure out a way so i can make a user url like such r6w.net/hughra but that really points to m.mgt?m=hughra ... i dont want folders, but rather a way yo get the info after the / and search the database then include the m.mgt?m=hughra querie an example of this is myspace.com 's urls... coding in php... any help
__________________ Completely Free cPanel Hosting -- Deployed to Afghanistan -- "There is no such thing as rich over-night unless you owned Google stock in 2006" |
| |
| | #2 (permalink) |
| NPQ's PA, Slave, and On Call Coder Technical Services | You could do something like.. .htaccess Code: # ex: r6w.net/user/hughra RewriteEngine on RewriteRule ^user/(.*)$ /m.mgt?m=$1 [L] PHP Code:
__________________ |
| |
| | #3 (permalink) |
| An American Soldier ![]() | wait... what if the site ever kicks off the .htacess file will be huge...
__________________ Completely Free cPanel Hosting -- Deployed to Afghanistan -- "There is no such thing as rich over-night unless you owned Google stock in 2006" Last edited by templaterave; 10-16-2006 at 08:16 PM. |
| |
| | #4 (permalink) |
| NPQ's PA, Slave, and On Call Coder Technical Services | No, that was just an example of what a member URL would look like, hence the # (which is a 'comment'). Those two lines are all you'll need in the .htaccess. As far as the PHP goes, yes, in whatever file you're going to use to process users.
__________________ |
| |
| | #5 (permalink) |
| An American Soldier ![]() | ok.. i got it to work.. but how would i strip the user/.. ex so its just r6w.net/ray ... i tried removing it from the script and i get an 500 error..
__________________ Completely Free cPanel Hosting -- Deployed to Afghanistan -- "There is no such thing as rich over-night unless you owned Google stock in 2006" |
| |
| | #7 (permalink) |
| An American Soldier ![]() | That part works fine... however... i do not want to use a subfolder for this. I want it to be just domain.com/loc instead of domain.com/sub/loc ... how would i remove the sub folder.... i removed it from the script but i can only get domain.com//loc to work.. and when i remove the / from the script i get an error...
__________________ Completely Free cPanel Hosting -- Deployed to Afghanistan -- "There is no such thing as rich over-night unless you owned Google stock in 2006" |
| |
| | #8 (permalink) |
| An American Soldier ![]() | Ok... I did a little reasearch on the subject.... The reason it doest work like that is because apache automatically searches for a folder or file in the base directory which causes a problem with the rewriteengine processing as such.. So then i realized that i would have to find a way for this... lone and behold that apache had a way to do this.... RewriteCond %{REQUEST_FILENAME} !-d Then I would have to include it. RewriteRule ^([^/.]+)$ m.mgt?m=$1 [L] and boom it works!!! Thanks to all that has helped me in this thread
__________________ Completely Free cPanel Hosting -- Deployed to Afghanistan -- "There is no such thing as rich over-night unless you owned Google stock in 2006" |
| |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| |