Pap
Pap

Reputation: 215

What does this mod rewrite do in htaccess file?

I have a little ht code , i just want to

Know what does this code do exactly ?

RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_URI} !public
RewriteCond %{REQUEST_URI} !robots.txt
RewriteRule . /index.php [L]
</IfModule>

Upvotes: 0

Views: 21

Answers (1)

anubhava
anubhava

Reputation: 786001

  1. 1st rule does www removal from your URL
  2. 2nd rule skips rewrite for /index.php
  3. 3rd rule rewrites all URIs except /public and /robots.txt to /index.php

References:

1. Apache mod_rewrite Introduction

2. Apache mod_rewrite Technical Details

Upvotes: 1

Related Questions