I want to convert my url www.mydomain.com/menu.php?id=1 to www.mydomain.com/menu./1

Hello friends.!!
I am new at .htaccess
i have a query
I want to convert my url www.mydomain.com/menu.php?id=1
to www.mydomain.com/menu./1
Please help with detail procedure…

Hi jun$,

You want to take a look at mod_rewrite and specifically around RewriteRule, here is a site that can give you a quick introduction
http://datakoncepts.com/seo and it has has Code Generator

Or you can read all of this off the Apache Site
http://httpd.apache.org/docs/current/mod/mod_rewrite.html

Hi cpradio,
Thanks for your info.
I will check out this.

Please post any follow up questions if you don’t find what you are looking for or it doesn’t make sense.

Thanks cp!

jun$,

That’s just too easy, however, as my tutorial states, it’s YOUR job to link to the new format and mod_rewrite’s job to redirect back to something which Apache can serve (in other words, your “convert … to” is the wrong direction). Yes, you can redirect to the new format then back to the original but that takes some slight of hand and, if you’re asking this question, you’re not quite ready for that yet!

To convert TO menu.php?id=1 from menu./1 (is that dot supposed to be there before the /???):

# .htaccess in domain.com's DocumentRoot

RewriteEngine on
RewriteRule ^menu\\./([0-9]+)$ menu.php?id=$1 [L]

This regex simply requires menu./ before some digits (and nothing else), captures the digits and redirects (without being seen - that would require the R=301 flag) to menu.php?id={the digits}.

If you have any questions on this or the tutorial, you know where to find me (or PM).

Regards,

DK

Just to add on, (if that dot shouldn’t be there ;))

# .htaccess in domain.com's DocumentRoot

RewriteEngine on
RewriteRule ^menu/([0-9]+)$ menu.php?id=$1 [L]

:smiley:

cp,

Amen (that was about the strangest thing I’ve seen in a while … but, if part of this member’s specification rather than a typo, it did have to be dealt with.

Regards,

DK