TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   General (http://www.talkphp.com/general/)
-   -   More help with mod_rewrite (http://www.talkphp.com/general/1812-more-help-mod_rewrite.html)

TerrorRonin 12-29-2007 04:22 PM

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=__

bdm 12-29-2007 04:45 PM

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


Wildhoney 12-29-2007 05:05 PM

...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.

TerrorRonin 12-29-2007 05:20 PM

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..?

dav 12-29-2007 05:25 PM

Hi, did you try whatever.com/page/id/ instead?


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

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0