Friendly URLs for CMS Project

Discuss practical ways rearrange URLs using mod_rewrite.

Friendly URLs for CMS Project

Postby ETbyrne » Sat Aug 09, 2008 8:02 am

Here's what I'm trying to accomplish:
  • All visits to ./whatever/anything/maybe go to index.php?p=whatever,anything,maybe
  • Does not affect URLs going to the ./bin dir
  • Does not affect URLs with file extensions, only affects urls like http://mysite.com/about not [url]http://mysite.com/feed.xml[/url]
  • I also want it to work for infinite dirs, like it could be ./mydir or ./mydir/number2 or even ./mydir/number2/number3 and so on.


Here is what I got so far, but it doesn't really work and as you can see it only takes into account the second item on my list:
Code: Select all
RewriteEngine on
RewriteRule ![^(bin)]$ index.php?p=$1 [L]


This is for a new PHP based CMS I have been working on. Thank you in advance for any help. :D
ETbyrne
 
Posts: 1
Joined: Sat Aug 09, 2008 7:58 am

Postby richardk » Sat Aug 09, 2008 11:38 am

Use "/" not ","
Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteCond %{REQUEST_URI} !^/bin(/.*)?|/.*\..*$ [NC]
RewriteRule ^(.*)$ /index.php?p=$1 [QSA,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 7 guests

cron