bingwalker Posted January 14, 2008 Share Posted January 14, 2008 Does anyone know of a really good mod rewrite generator? I need one, because I'm a noob. I'm trying to turn: gowns?p=46 into: christening-gowns/p/46 Should be simple enough, but I can't seem to get it right. Can someone help me out with this? Thanks! Link to comment https://forums.phpfreaks.com/topic/85963-mod-rewrite-generator/ Share on other sites More sharing options...
madmax Posted January 14, 2008 Share Posted January 14, 2008 You missed the preceding URL off your example and perhaps some other information - so I assume "gowns" is a subdir from root and there are no other conditions Assume no redirection - just rewriting Original URL in browser bar Will accept domain.com/gowns/?p=46 (folder location properly terminated with /) Will not accept domain.com/gowns?p=46 (since this is assumed a folder) Case conversion on paths ignored (todo but prob not required) Version for httpd.conf not .htaccess (requires a RewriteBase / for .htaccess and no prefix / on RewriteRule Force target as /index.htm (not recommended but avoids secondary rewrite probs. appending index file) Try ... RewriteEngine ON #RewriteLogLevel 9 #RewriteLog logs/rewrite.log RewriteCond %{QUERY_STRING} ^p=([0-9]+)$ [NC] RewriteRule /gowns/$ /christening-gowns/p/%1/index.htm [NC,L] Link to comment https://forums.phpfreaks.com/topic/85963-mod-rewrite-generator/#findComment-439284 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.