Thread: mod_rewrite
View Single Post
  #22  
Old 12-02-2005, 09:29 AM
dvolve Offline
pp regular
 
Join Date: Dec 2005
Location: San Francisco, CA
Posts: 31
Quote:
Originally Posted by jaywilliams
Just want to let you know that I've modified my pixelpost enough using mod_rewrite that you will never see the .php extension or the ?x= in the address box.

Here is my .htaccess file:
Code:
Options -Indexes
RewriteEngine on
RewriteRule ^(browse|about)$ index.php?x=$1&pagenum=1
RewriteRule ^browse/([0-9]+)$ index.php?x=browse&category=&pagenum=$1
RewriteRule ^browse/category/([0-9]+)/([0-9]+)$ index.php?x=browse&category=$1&pagenum=$2
RewriteRule ^browse/category/([0-9]+)$ index.php?x=browse&category=$1&pagenum=1
RewriteRule ^comment/([0-9]+)$ index.php?popup=comment&showimage=$1
RewriteRule ^comment/submit$ index.php?x=save_comment
RewriteRule ^photo/([0-9]+)$ index.php?showimage=$1
RewriteRule ^photo/([0-9]+)/rating/([1-5])$ index.php?showimage=$1&rating=$2
RewriteRule ^photo/file/(.+)$ /images/$1
RewriteRule ^thumbnails/latest$ index.php?showthumb=latest&thumbtag=image
RewriteRule ^feeds/(rss|atom).xml$ index.php?x=$1
RewriteRule ^browse/archive/(.*)/([0-9]+)$ index.php?x=browse&archivedate=$1&pagenum=$2
RewriteRule ^browse/archive/(.*)$ index.php?x=browse&archivedate=$1&pagenum=1
As you can see this will do just about anything.

For example... if I want to see image number 31 I go to:
http://photoblog.differentview.us/photo/31

If I want to post a comment on photo 31 I go to:
http://photoblog.differentview.us/comment/31

The real trick is modifying the browse page to accept options like that.
Browse View Cat 7:
http://photoblog.differentview.us/browse/category/7
Browse View Cat 7 Page 1:
http://photoblog.differentview.us/browse/category/7/1
Browse View Photos during the month of October, 2005:
http://photoblog.differentview.us/br...rchive/2005-10

By using that .htaccess file and by tweaking the links that pixel post uses, you can do the same.

Give me a call or drop me an e-mail if you want some of my modified php files or more info on how you can do it.

Phone: 352-397-2506
Skype: d3designs
E-mail: d3designs AT gmail.com
AIM: gwdjay

Hey mate awesome job on the template... could you have one posted for ppl (novices) like me to use and edit aorund... and of course credit will be given in the footers to you.. cheers!
Reply With Quote