hi guys, I need help regarding a rewrite rule for some of my client work . First guy to put the solution up here on thread will get 5 usd. I want the rewrite urls to be worked like. www.domain.com/name1 == www.domain.com/page.php?name=name1 www.domain.com/name2 == www.domain.com/page.php?name=name1 www.domain.com/name1/value1 == www.domain.com/newpage.php?value=value1 etc.. Now, I am trying this rewrite, But it doesn't seems helping. RewriteRule ^(.*)$ page.php?name=$1 [NC] RewriteRule ^(.*)/(.*)$ newpage.php?value=$2 [NC] Any help will be appreciated guys !
EDIT: Oh, I see what you did: Try this: RewriteEngine on RewriteRule ^([^/\.]+)/?$ page.php?name=$1 [NC] RewriteRule ^[^/\.]+/([^/\.]+)/?$ newpage.php?value=$1 [NC] Code (markup): (Assuming www.domain.com/name2 == www.domain.com/page.php?name=name1 <-- name1 was a typo, of course. )
Try this: RewriteEngine On RewriteRule ^([a-z0-9-]+)[/]*$ page.php?name=$1 RewriteRule ^name1/([^/\.])/$ /newpage.php?value=$1 Code (markup):
Thanks @ carolynheath That works, However, One small thing. on the url www.domain.com/name1/value1 All my images and css settings are missing, I guess because my parent path is now www.domain.com/name1 instead of www.domain.com , Any workaround for that ? Send me your paypal id too, Please
using mod_rewrite may srew up finding your css and pictures To avoid this use html base <head> <!-- … --> <base href="http://www.mydomain.com/" /> <!-- … other head tags … --> </head> See the thread here for more details http://forums.digitalpoint.com/showthread.php?t=23044