Prabhakar Kasi's Raptor.in

Interesting News Naturally Interests Everyone

Archive for the ‘Apache’ Category

Apache URL Redirecting

Posted by admin On March - 21 - 2009

apache_logoURL Redirect

URL Redirection is used primarily for redirecting from old URL to new URL.

My OLD URL was

http://entertainment.raptor.in/mirchi%20suchi/

which i needed to redirect to

http://raptor.in/?s=suchitra

Solution
Redirect 301 “/mirchi suchi/” http://raptor.in/?s=suchitra

Challenge
The challenge here was that my old url contained a white space which took me a lot of time to fix. Then I found a solution after googleing. To understand the solution I found was even more challenging. Since entertainment.raptor.in was a sub-domain I tried to put this redirect rule in .htaccess in the entertainment folder.

Read the rest of this entry »

Popularity: 6% [?]

Apache URL Rewriting

Posted by admin On February - 6 - 2009

Basic URL Rewriting

To begin with, let’s consider a simple example. We have a website, and we have a single PHP script that serves a single page. Its URL is:
http://www.pets.com/pet_care_info_07_07_2008.php

We want to clean up the URL, and our ideal URL would be:
http://www.pets.com/pet-care/

In order for this to work, we need to tell the server to internally redirect all requests for the URL “pet-care” to “pet_care_info_07_07_2008.php”. We want this to happen internally, because we don’t want the URL in the browser’s address bar to change.

RewriteEngine On    # Turn on the rewriting engine
RewriteRule    ^pet-care/?$    pet_care_info_01_02_2003.php    [NC,L]    # Handle requests for “pet-care”

For detailed options visit this URL

http://www.addedbytes.com/apache/url-rewriting-for-beginners/

Popularity: 3% [?]