Little bit about Mod_Rewrite

By arin2u | September 2, 2007
Topics: Tech Talks |

Mod_Rewrite is a rewrite engine or web server software of Apache HTTP server and is used for rewriting web page url at the server level giving the final output to the user. This rewrite engine is mainly used for making the web page url more user and search engine friendly.

If you provide users with meaningful urls that really describes the content of that page, then it will be easier for them to keep in mind. Moreover search engines also find it easy to index pages whose urls have been rewritten using mod-rewrite.

To run the mod-rewrite, you should have the mod_rewrite module installed on your Apache server. To check whether you have mod_rewrite installed, you need to create a file named phpinfo.php, write and save it on your server. Then search for “mod_rewrite” and you will find it in the “Apache loaded section”. If you miss that, you can ask for it to your hosting company.

The Mod_rewrite rule is written in .htaccess file. The .htaccess (hypertext access) file is a text file which contains Apache directives. Any directives that you use will be applicable to the directory where .htaccess files resides and all the sub-directory under it.

The structure of rewrite rule

RewriteRule Pattern Substitution [OptionalFlags]

Where,

RewriteRule is just the name of the command. Pattern is a regular expression, which will be applied to the current url. Any back references or server variable names can be used in substitution. OptionalFlags are the only mandatory part in the RewriteRule. The flags should be written within square brackets and separated by comma. You can find full list of flags in the Apache mod_rewrite manual.

Technorati Tags: , , ,

Share it if you liked it: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • del.icio.us
  • bodytext
  • Technorati
  • YahooMyWeb
  • blinkbits
  • BlinkList
  • Reddit
  • Furl
  • Google
  • StumbleUpon
  • Propeller
  • Facebook
  • NewsVine

Back to: Home
Previous Post: How to fix MX record for Google apps?
Next Post: Social Media - a brief idea


3 Comments to "Little bit about Mod_Rewrite"

TrackBack URI

Please share your thoughts




You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

arin2u This is Arindam aka arin2u. I love blogging and I do it in simple ways. I like learning new things. SEO, internet marketing are my niche fields.
Add to Technorati Favorites
Top Blogs
Mail Me:
Feed subscriber
  • Web Tools

  • Recent Posts

  • Page copy protected against web site content infringement by Copyscape

  • Pages

  • Blog Directories


  • My blog is worth $12,419.88.
    How much is your blog worth?