| |||||||
| Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics. |
![]() |
| | LinkBack | Thread Tools |
| | #1 (permalink) |
| Barru. | mod_rewrite question I want to make all my url's in the form "index.php?p=<name of page>&<additional info>" into "<name of page>.php?<additional info>" I have figured out the regex to match all my pagess (i think) Code: index.php?p=[a-zA-Z0-9]{1,}&[a-zA-Z0-9&=]{1,}
__________________ |
| |
| | #2 (permalink) |
| NamePros Regular | Erm lemme see if i can remember this right... Code: RewriteRule ^([a-zA-Z0-9]+)\.php?([a-zA-Z0-9&=]+)$ index.php?p=$1&catid=$1&$2 [L] Code: RewriteRule ^(.*)\.php?(.*)$ index.php?p=$1&$2 [L] Code: RewriteRule ^(.*)\.php?(.*)$ index.php?p=$1&additionalinfo=$2 [L] That is how i would do it. Be sure to enclose that rule in tags like: Code: <IfModule mod_rewrite.c> Code: </IfModule>
__________________ -Beaver6813.com V5 Soon! |
| |
| | #4 (permalink) |
| NamePros Regular | Yeah that would be better masking it as a html, but if he wants to keep it as a php file then fine For example on one of my gaming sites i use mod_rewrite: Code: RewriteRule ^showcat/([0-9]+)/([0-9]+)/(.*)\.html$ index.php?action=showcat&catid=$1&parentid=$2 [L] it will redirect it all to the php file. Very fun to do ^^
__________________ -Beaver6813.com V5 Soon! |
| |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| |