Welcome to WebmasterWorld Guest from 54.146.180.94

Forum Moderators: Ocean10000 & incrediBILL & phranque

Redirection

   
5:15 am on Dec 17, 2012 (gmt 0)

5+ Year Member



Hi Please help me to create htaccess file for this


www.site.com/category.php?id=15
converted to
www.site.com/art if 15 is the ID of art

www.site.com/category.php?id=25
converted to
www.aite.com/art/animation

if 25 is the ID of animation where art is the parent of animation


and so on till three level


www.site.com/category.php?id=25&page=1
converted to
www.site.com/art/animation/1


Thanks
6:04 am on Dec 17, 2012 (gmt 0)

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month



Uh-oh, time for the boilerplate.

:: shuffling papers ::

Why We Make You Do It Yourself

There are plenty of forums where you can post a "how-to" question and get a fairly immediate answer. The answer may even be correct. But WebmasterWorld is about teaching you how to do it yourself. That way you can roll your own htaccess-- not just for today's problem but for tomorrow's almost identical one.

Here is the analogy:

Your child's room needs cleaning. You know that you can clean it yourself much faster and better than if you have to stand over your child and force him to do it right. But if you do the "make him get it right" part often enough, you will have raised a child who knows how to clean his room-- and who will some day stand glowering over his own children in the same circumstances.

Some day, someone else will post a question in the WebmasterWorld forums and you'll say "Hey, I know the answer to that one!"

Besides, when someone with a very low post count asks a question, that person may have posted the identical question in six different forums. They grab the first answer they get, and never even come back to the others. You can understand that this is infuriating for the person who took the time to compose an answer.


Still with us? Let's have a look at what you have done so far. It sounds like the basic redirect-to-rewrite two-step. In fact I have another and much longer boilerplate about that one, so count your blessings. It's a very popular question, so the Forums should have lots of ideas to help you get started.
8:55 am on Dec 17, 2012 (gmt 0)

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



Unless we're talking about only a small number of URLs you'll need to rewrite the request to a special PHP script that looks in the database for the name for the ID and then sends a 301 HEADER directive.

You'll also need to modify the PHP script that runs the site to link to the new URLs from the pages of the site. Clicking navigation links within a site should never lead to a redirect.
 

Featured Threads

My Threads

Hot Threads This Week

Hot Threads This Month