| | |||||
| ||||||||
| Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics. |
![]() |
| | LinkBack | Thread Tools |
| | THREAD STARTER #1 (permalink) |
| Senior Member Join Date: Jun 2005 Location: Pennsylvania
Posts: 1,839
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | 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
__________________ Poker News, articles, discussion LIKE THIS Its an iPod, a phone, and an internet communications device. |
| |
| | #2 (permalink) |
| Senior Member Join Date: Mar 2005
Posts: 4,948
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | You could do something like.. .htaccess Code: # ex: r6w.net/user/hughra RewriteEngine on RewriteRule ^user/(.*)$ /m.mgt?m=$1 [L] ????: NamePros.com http://www.namepros.com/programming/248010-creating-a-virtual-url.html PHP Code: |
| |
| | THREAD STARTER #3 (permalink) |
| Senior Member Join Date: Jun 2005 Location: Pennsylvania
Posts: 1,839
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | wait... what if the site ever kicks off the .htacess file will be huge...
__________________ Poker News, articles, discussion LIKE THIS Its an iPod, a phone, and an internet communications device.
Last edited by templaterave; 10-16-2006 at 09:16 PM.
|
| |
| | #4 (permalink) |
| Senior Member Join Date: Mar 2005
Posts: 4,948
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | 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. |
| |
| | THREAD STARTER #5 (permalink) |
| Senior Member Join Date: Jun 2005 Location: Pennsylvania
Posts: 1,839
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | 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..
__________________ Poker News, articles, discussion LIKE THIS Its an iPod, a phone, and an internet communications device. |
| |
| | THREAD STARTER #7 (permalink) |
| Senior Member Join Date: Jun 2005 Location: Pennsylvania
Posts: 1,839
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | 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...
__________________ Poker News, articles, discussion LIKE THIS Its an iPod, a phone, and an internet communications device. |
| |
| | THREAD STARTER #8 (permalink) |
| Senior Member Join Date: Jun 2005 Location: Pennsylvania
Posts: 1,839
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | 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
__________________ Poker News, articles, discussion LIKE THIS Its an iPod, a phone, and an internet communications device. |
| |