My Blog

21/04/2010

Try to understand .htaccess file in default symfony 1.4 project

Filed under: Công việc,Học tập — dinhnhy @ 5:29 pm

Options +FollowSymLinks +ExecCGI

  RewriteEngine On                      # <-- switch the rewrite engine on

  # uncomment the following line, if you are having trouble
  # getting no_script_name to work
  #RewriteBase /                        #  The resource requested in the HTTP request line, eg: "/index.html"

  # we skip all files with .something
  #RewriteCond %{REQUEST_URI} \..+$     # <-- if uri match  'dot "something"' at the end of string
  #RewriteCond %{REQUEST_URI} !\.html$  # <-- and if uri does not match 'dot &quot;html&quot;' at the end of string
  #RewriteRule .* - [L]                 # <-- rule: don't substitute any thing; this is the last rule, don't run any other rule

  # we check if the .html version is here (caching)
  RewriteRule ^$ index.html [QSA]       #  append to the URL instead of replacing it
  RewriteRule ^([^.]+)$ $1.html [QSA]   #  append to the URL instead of replacing it
                                        # %{REQUEST_FILENAME} -> The full local filesystem path to the file or script matching the request
  RewriteCond %{REQUEST_FILENAME} !-f   # <-- if the local file does not exist

  # no, so we redirect to our front web controller
  RewriteRule ^(.*)$ index.php [QSA,L]  #  append to the URL instead of replacing it; this is the last rule, don't run any other rule

Advertisement

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Theme: Rubric. Blog at WordPress.com.

Follow

Get every new post delivered to your Inbox.