Im Stuck ! Please help me with my cms

Discuss practical ways rearrange URLs using mod_rewrite.

Im Stuck ! Please help me with my cms

Postby pacms » Tue Mar 24, 2009 5:31 pm

Code: Select all
RewriteEngine on

RewriteRule ^deposit-options/?$ deposit_options.php [L]
RewriteRule ^deposit-options/([^/\.]+).htm?$ deposit_options.php?deposit=$1 [L]

RewriteRule ^reviews/?$ site_review.php [L]
RewriteRule ^reviews/([^/\.]+).htm?$ site_review.php?site=$1 [L]

RewriteRule ^articles/?$ articles.php [L]
RewriteRule ^articles/([^/\.]+)/?$ articles.php?cat=$1 [L]
RewriteRule ^articles/([^/\.]+)/([^/\.]+).htm?$ articles.php?cat=$1&at=$2 [L]

RewriteRule ^poker-bonus/?$ bonus.php [L]
RewriteRule ^poker-bonus/([^/\.]+).htm?$ bonus.php?display=$1 [L]

RewriteRule ^usa/?$ usa.php [L]
RewriteRule ^usa/([^/\.]+).htm?$ usa.php?display=$1 [L]

RewriteRule ^main.css?$ css.php [L]


Currently my htaccess listed above gives me the following urls.

mysite.com/reviews
mysite.com/reviews/site.htm
mysite.com/poker-bonus/
mysite.com/poker-bonus/usa.htm

But I would like the ability to edit the first part of the url structure ("reviews", "poker-bonus") via the admin panel.

I can handle the php part Im just stuck with the mod rewrite.
If anyone can point me in the right direction I would be most grateful.

Thanks for reading.
pacms
 
Posts: 1
Joined: Tue Mar 24, 2009 10:40 am

Postby richardk » Wed Mar 25, 2009 3:22 pm

Is there going to be one value for each or many values?

The problem is that if you make
Code: Select all
^articles/?$

and
Code: Select all
^poker-bonus/?$

both become
Code: Select all
^[^/]+/?$

and only the first will match.

You shouldn't have ? at the end of every pattern
Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteRule ^deposit-options/?$            /deposit_options.php            [L]
RewriteRule ^deposit-options/([^/]+)\.htm$ /deposit_options.php?deposit=$1 [L]

RewriteRule ^reviews/?$            /site_review.php         [L]
RewriteRule ^reviews/([^/]+)\.htm$ /site_review.php?site=$1 [L]

RewriteRule ^articles/?$                    /articles.php              [L]
RewriteRule ^articles/([^/]+)/?$            /articles.php?cat=$1       [L]
RewriteRule ^articles/([^/]+)/([^/]+)\.htm$ /articles.php?cat=$1&at=$2 [L]

RewriteRule ^poker-bonus/?$            /bonus.php            [L]
RewriteRule ^poker-bonus/([^/]+)\.htm$ /bonus.php?display=$1 [L]

RewriteRule ^usa/?$            /usa.php            [L]
RewriteRule ^usa/([^/]+)\.htm$ /usa.php?display=$1 [L]

RewriteRule ^main\.css$ /css.php [L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am


Return to Friendly URLs with Mod_Rewrite

Who is online

Users browsing this forum: No registered users and 21 guests

cron