Mod_Rewrite Hack
Posted by TIG
All files from this thread
File Name | File Size | Posted by | Date | ||
---|---|---|---|---|---|
sef.php | 920 bytes | open | download | Thomas Seifert | 11/28/2004 | Read message |
Mod_Rewrite Hack November 28, 2004 06:20AM |
Registered: 18 years ago Posts: 4 |
Hi,
I searched, but didn't found this hack.
I would do it by myself, but i have no knowledge about the parsing-part. For a php-coder it should be a simple job.
Perhaps someone is interessted in this hack, too. It would improve usability and Google likes it.
Mod_Rewrite? Cryptic Urls become readable paths!
/list.php?1 > /offtopic/
/list.php?2 > /support/
/list.php?3 > /feedback/
/read.php?2,1 > /support/1/
/read.php?2,2 > /support/2/
/search.php > /search/
/search.php?1 > /support/search/
Thanks for your attention.
Martin.
--
My Board: [www.ddig.de]
My Mailadress: mr@ddig.de
I searched, but didn't found this hack.
I would do it by myself, but i have no knowledge about the parsing-part. For a php-coder it should be a simple job.
Perhaps someone is interessted in this hack, too. It would improve usability and Google likes it.
Mod_Rewrite? Cryptic Urls become readable paths!
/list.php?1 > /offtopic/
/list.php?2 > /support/
/list.php?3 > /feedback/
/read.php?2,1 > /support/1/
/read.php?2,2 > /support/2/
/search.php > /search/
/search.php?1 > /support/search/
Thanks for your attention.
Martin.
--
My Board: [www.ddig.de]
My Mailadress: mr@ddig.de
Re: Mod_Rewrite Hack November 28, 2004 06:31AM |
Admin Registered: 20 years ago Posts: 9,240 |
thats an even more tough hack than the usual mod_rewrite changes.
usually you would do something like that:
/list.php?1 > /list/1
/list.php?2 > /list/2
/list.php?3 > /list/3
mod_rewrite doesn't know about the names and you would need to hardcode all the names therefore.
btw.: nice template there :)
Thomas Seifert
Edited 1 time(s). Last edit at 11/28/2004 06:32AM by ts77.
usually you would do something like that:
/list.php?1 > /list/1
/list.php?2 > /list/2
/list.php?3 > /list/3
mod_rewrite doesn't know about the names and you would need to hardcode all the names therefore.
btw.: nice template there :)
Thomas Seifert
Edited 1 time(s). Last edit at 11/28/2004 06:32AM by ts77.
Re: Mod_Rewrite Hack November 28, 2004 06:43AM |
Registered: 18 years ago Posts: 4 |
Re: Mod_Rewrite Hack November 28, 2004 06:46AM |
Admin Registered: 20 years ago Posts: 9,240 |
Re: Mod_Rewrite Hack November 28, 2004 07:06AM |
Registered: 18 years ago Posts: 4 |
> forum-name <-> forum-id
> mod_rewrite is apache-specific
oh, i thought there is eventually a way php could rewrite the .htaccesfile.
ok, i'll try it on my own. i think i just need to hack the dynamic intern linkage and adjust the .htaccess-file with my own forum-names.
time to learn more about php.
thx thomas.
> mod_rewrite is apache-specific
oh, i thought there is eventually a way php could rewrite the .htaccesfile.
ok, i'll try it on my own. i think i just need to hack the dynamic intern linkage and adjust the .htaccess-file with my own forum-names.
time to learn more about php.
thx thomas.
Re: Mod_Rewrite Hack November 28, 2004 06:50PM |
Admin Registered: 20 years ago Posts: 9,240 |
Re: Mod_Rewrite Hack November 28, 2004 07:23PM |
Registered: 18 years ago Posts: 4 |
Re: Mod_Rewrite Hack November 29, 2004 12:31PM |
Admin Registered: 20 years ago Posts: 9,240 |
Re: Mod_Rewrite Hack December 07, 2004 05:36AM |
Registered: 21 years ago Posts: 80 |
About the ruleset. This works for me:
RewriteRule ^([^/]*)/([0-9])/([^/]*)/(.*)$ $1/$2/$3,$4
RewriteRule ^([^/]*)/([0-9])/([^/]*)$ $1?$2,$3
RewriteRule ^([^/]*)/([0-9])$ $1?$2
This rewrites all urls of the form
file.php/N/X1/X2/X3/X4/.../Xk to
file.php?N,X1,X2,X3,X4,...,Xk
where N is a number and X1,X2,...,Xk are any string not including a slash ('/').
It works for me, but I'm not sure why! ;) My initial try was with some [N] flags on the first rule, but that doesn't seem to be needed...
f
RewriteRule ^([^/]*)/([0-9])/([^/]*)/(.*)$ $1/$2/$3,$4
RewriteRule ^([^/]*)/([0-9])/([^/]*)$ $1?$2,$3
RewriteRule ^([^/]*)/([0-9])$ $1?$2
This rewrites all urls of the form
file.php/N/X1/X2/X3/X4/.../Xk to
file.php?N,X1,X2,X3,X4,...,Xk
where N is a number and X1,X2,...,Xk are any string not including a slash ('/').
It works for me, but I'm not sure why! ;) My initial try was with some [N] flags on the first rule, but that doesn't seem to be needed...
f
Re: Mod_Rewrite Hack December 28, 2004 08:12AM |
Registered: 18 years ago Posts: 8 |
my Mod_Rewrite Hack
RewriteEngine on
RewriteRule ([^/]*),([^/]*).html$ read.php?$1,$2
RewriteRule ([^/]*),([^/]*),([^/]*).html#([^/]*)$ read.php?$1,$2,$3#$4
RewriteRule ([^/]*),([^/]*),([^/]*),([^/]*).html#([^/]*)$ read.php?$1,$2,$3,$4#$5
RewriteRule sub_([^/]*).html$ index.php?$1
RewriteRule list_([^/]*).html$ list.php?$1
RewriteRule post_([^/]*).html$ post.php?$1
i think maybe the google robot will find the *.html docs more easily than *.php?**
RewriteEngine on
RewriteRule ([^/]*),([^/]*).html$ read.php?$1,$2
RewriteRule ([^/]*),([^/]*),([^/]*).html#([^/]*)$ read.php?$1,$2,$3#$4
RewriteRule ([^/]*),([^/]*),([^/]*),([^/]*).html#([^/]*)$ read.php?$1,$2,$3,$4#$5
RewriteRule sub_([^/]*).html$ index.php?$1
RewriteRule list_([^/]*).html$ list.php?$1
RewriteRule post_([^/]*).html$ post.php?$1
i think maybe the google robot will find the *.html docs more easily than *.php?**
Sorry, only registered users may post in this forum.