|
#1
|
||||
|
||||
|
mod_rewrite
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 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. If you would like to get your hands on some already-modified php files, check out my Post Slug addon: http://www.pixelpost.org/forum/showthread.php?t=4915
__________________
Jay Williams | A Different View Last edited by jaywilliams; 02-25-2008 at 04:01 PM. |
|
#2
|
||||
|
||||
|
thanks for sharing this, i like the way this one handles the structure.
i do have a uestion, not knowing all that much about a link structure rewrite...what happens to all my old url's? will they redirect or still work? you might want to PM GeoS and talk with him about it, he's handling the rewrite system for future versions of pixelpost
__________________
i should say more clever stuff |
|
#3
|
||||
|
||||
|
Quote:
The answer is yes, for the most part... Let me explain. Here is a link... Code:
http://www.pixelpost.org/demo/1.4.2/index.php?showimage=2 Code:
http://www.pixelpost.org/demo/1.4.2/photo/2 The only reason they wouldn't is when you start using relative links. the url /photo/2 is not a real folder. so if you have an image (or any link) that has a relative url the browser can't process it properly. Example: if you had a relive link like this: HTML Code:
index.php?x=browse HTML Code:
/photo/2index.php?x=browse The trick is to make all urls absolute... Like this... HTML Code:
/index.php?x=browse That goes for images, css and anything that is linked to. So as long as the link is set to the root directory, like it should be, everything works fine... but as soon as the links start sending to the "virtual" directories it starts messing up. Remember the slash ( "/" ) and you should be ok.
__________________
Jay Williams | A Different View |
|
#4
|
||||
|
||||
|
i'm using it now! cheers.
didnt' take long to fix my links and tags to suit it: edit the rewrite a bit to include some other pages: http://photos.jlspurling.com cheers!
__________________
Affordable Website Design in North Wales |
|
#5
|
||||
|
||||
|
That's great Joe[y]!
Glad you were able to integrate it so quickly! It's very nice too... I might add.
__________________
Jay Williams | A Different View |
|
#6
|
||||
|
||||
|
i'm going to sticky this thread
__________________
i should say more clever stuff |
|
#7
|
||||
|
||||
|
Quote:
|
|
#8
|
||||
|
||||
|
Quote:
Just place the .htacces file in the root directory.
__________________
Jay Williams | A Different View |
|
#9
|
||||
|
||||
|
Quote:
See: http://klasa.born66.net .htaccess is placed in root directory of this subdomain |
|
#10
|
||||
|
||||
|
Quote:
eg. http://klasa.born66.net/photo/14 http://klasa.born66.net/about http://klasa.born66.net/browse http://klasa.born66.net/browse/category/1 You get the point. So look at your templates and the source code for pixel post, and modify the links. NOTE: Make sure all your links (inc images) are set like this. /photos/photo.jpg not like: photos/photo.jpg Make sure you have the SLASH at the beginning.
__________________
Jay Williams | A Different View |
| Post Reply |
| Thread Tools | |
|
|