TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 12-29-2007, 04:22 PM   #1 (permalink)
The Contributor
 
Join Date: Dec 2007
Posts: 31
Thanks: 0
TerrorRonin is on a distinguished road
Default More help with mod_rewrite

Alright.. So I know this is a simple fix.. i'm just retarded =\

I need urls such as

domain.com/page/id

To mean the same as

domain.com/index.php?page=___&id=__
TerrorRonin is offline  
Reply With Quote
Old 12-29-2007, 04:45 PM   #2 (permalink)
bdm
The Acquainted
Good Samaritan 
 
Join Date: Nov 2007
Posts: 127
Thanks: 14
bdm is on a distinguished road
Default

You will need something along the lines of in your .htaccess:
Code:
RewriteEngine On
RewriteRule ^([0-9a-Z]+)/([0-9]+)/$ /index.php?page=$1&id=$2
bdm is offline  
Reply With Quote
Old 12-29-2007, 05:05 PM   #3 (permalink)
La Vida es Sueño
Advanced Programmer Top Contributor 
 
Wildhoney's Avatar
 
Join Date: Sep 2007
Location: Oldham
Posts: 2,280
Thanks: 90
Wildhoney is on a distinguished road
Default

...Alternative I use the following syntax:

Code:
RewriteEngine On
RewriteRule ^([^\/]+)/([^\/]+)/$ /index.php?page=$1&id=$2
But for integers you should really tell the htaccess that you're only expecting an integer, as in the above example by bdm.
__________________
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.
Send a message via AIM to Wildhoney Send a message via MSN to Wildhoney Send a message via Yahoo to Wildhoney
Wildhoney is offline  
Reply With Quote
Old 12-29-2007, 05:20 PM   #4 (permalink)
The Contributor
 
Join Date: Dec 2007
Posts: 31
Thanks: 0
TerrorRonin is on a distinguished road
Default

Hm... I added the code to my server.. but when I put in any url (whatever.com/page/) it says the directory doesnt exist.. wtf.. I know my mod_rewrite is turned on..?
TerrorRonin is offline  
Reply With Quote
Old 12-29-2007, 05:25 PM   #5 (permalink)
dav
The Wanderer
 
dav's Avatar
 
Join Date: Dec 2007
Location: Manchester, UK
Posts: 9
Thanks: 1
dav is on a distinguished road
Default

Hi, did you try whatever.com/page/id/ instead?
dav is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 08:09 AM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design