Forum Moderators: phranque

Message Too Old, No Replies

URL Rewriting - automatic convert

URL Rewriting - .htaccess

         

rajnesh

7:16 am on Jun 2, 2008 (gmt 0)

10+ Year Member



Hi Guys

I have set below syntaxt in my site

Options +FollowSymLinks
RewriteEngine on
RewriteRule pictures/(.*)/ pictures.php?gallery=$1

enter above syntax in .htaccess file we convert

[mysite.com...] to url

[mysite.com...]

but somebody enter directly first one like
[mysite.com...]

so, my requirement is if anybody type "pictures.php?gallery=4" then automatic convert /pictures/4/

Please help me

Thanks in Advance
Rajnesh

g1smd

9:05 am on Jun 2, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



You need a rewrite from static URL to dynamic filepath and a redirect from dynamic URL to static URL.

There are hundreds of prior examples of how to do that here in this forum.

The redirect has similar syntax to the rewrite, except the redirect will also include the target domain and [R=301] in the rule.

You'll likely need a RewriteCond on each one to stop any sort of infinite loop occurring too.

jdMorgan

4:14 pm on Jun 2, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



This thread on Changing Dynamic URLs to Static URLs [webmasterworld.com] describes what you're trying to do as step three of the three steps in changing from dynamic to static URLs, and gives an example of how to do it.

Jim

hongvuct

8:38 am on Jun 6, 2008 (gmt 0)

10+ Year Member



i have same problem. but i want change at status and link. i think have some code at php?