Jump to content

Mod Rewrite generator?


bingwalker

Recommended Posts

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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.