Debianhelp.co.uk

URL Rewriting Using mod_rewrite in Apache

mod_rewrite is the Swiss Army Knife of URL manipulations. It provides virtually all of the functions one would ever need to manipulate URLs, and its functionality is highly generalized. Consequently, mod_rewrite can be used to solve all sorts of URL-based problems. The drawback is the high learning curve, because this module is based on a complex rule-based matching engine, which uses regular expressions for its patterns. Although the flexibility of mod_rewrite makes it a very complex tool, once you understand the basic idea you will master all existing and forthcoming URL-based problems in your webmaster's life.

correct syntax to place in a
.htaccess file to allow the url to be rewritten in a spiderable format. The apache module mod_rewrite converts urls in a certain format to another format, and can be very useful in helping a site with dynamic content to be indexed.


Example :-


We have a php script that creates an rss feed from an html webpage. However, the url is a mess, and some rss directories don't seem to work with it.We would like to use .htaccess to change something like this:

http://example-domain.com/rssscript.php?pageurl=http%3A%2F%2Fexample-domain.com%2Fbneficiary.html

to this:

http://example-domain.com/rssscript.php?pageurl=http://example-domain.com/bneficiary.html

Solution

Here Is the Rule

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

For more examples and more detais check these links

http://httpd.apache.org/docs/2.0/misc/rewriteguide.html

http://www.sitepoint.com/article/guide-url-rewriting

http://www.webmaster-toolkit.com/mod_rewrite-rewriterule-generator.shtml



 

 

 

 

 

 

 

 

 

 

2)