Hi i am new to php.
I want to url rewrite for my site.
I having problem for creating rule for url rewriting.
I have one page whose link is like this:
http://www.example.com/Category/Category.php?Cat_Id=1
I want to have like this:
http://www.example.com/1/Category.html
Other Page like this:
http://www.example.com/Product/Product.php?Name=Example
I want to have like this:
http://www.example.com/Example/Product.html
Please Help Me
Thanks in Advance.
Problem in creating rule for url rewriting
Moderator: General Moderators
Re: Problem in creating rule for url rewriting
You should have asked in the Regex forum.
I didn't know where $2 should belong since the directory and file both had the same values. Replace the ???s appropriately.
If you have real directories that are just numbers then you'll need those two RewriteConds for the first rule too.
Code: Select all
RewriteRule ^/?(\d+)/([^.])(.html)?$ /???/???.php?Cat_Id=$1 [L,QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^/?([^/]+)/([^.]+)(.html)?$ /???/???.php?Name=$1 [L,QSA]If you have real directories that are just numbers then you'll need those two RewriteConds for the first rule too.
Re: Problem in creating rule for url rewriting
Thank you tasaris.
I really appreciate your help.
We have discuss this issue also before.
but that time i didn't figure out this problem.
But this time I got problem solved.
Thanks for your help and be patience with me.

I really appreciate your help.
We have discuss this issue also before.
but that time i didn't figure out this problem.
But this time I got problem solved.
Thanks for your help and be patience with me.