| | |||||
| ||||||||
| Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics. |
![]() |
| | LinkBack | Thread Tools |
| | THREAD STARTER #1 (permalink) |
| Senior Member Join Date: Aug 2005 Location: East Yorkshire, England
Posts: 2,689
![]() ![]() ![]() ![]() ![]() ![]() ![]() | 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 Join Date: May 2005 Location: England
Posts: 392
![]() ![]() ![]() | 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> ????: NamePros.com http://www.namepros.com/programming/253280-mod_rewrite-question.html Code: </IfModule>
__________________ -Beaver6813.com - Web Developer Extraordinaire! |
| |
| | #3 (permalink) |
![]() Join Date: Jul 2006
Posts: 4,607
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | mod_rewrite enable "path/<name of page>/<additional info>.html" for your better search engine results right?
__________________ juegosjuegos Your Hotel in Austria Matratzen Domain Acquisition | Store all your favorite links! | Web Proxies Proxy List | Bookmarks | Creative Enquiry | Web Proxy List |
| |
| | #4 (permalink) |
| NamePros Regular Join Date: May 2005 Location: England
Posts: 392
![]() ![]() ![]() | Yeah that would be better masking it as a html, but if he wants to keep it as a php file then fine ????: NamePros.com http://www.namepros.com/showthread.php?t=253280 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 - Web Developer Extraordinaire! |
| |