SlideShare a Scribd company logo
1 of 104
mod_rewrite
Uses
Uses

•   Obscure original URLs
Uses

•   Obscure original URLs
•   Clean URLs
Uses

•   Obscure original URLs
•   Clean URLs
•   SEO (Seriously.)
Uses

•   Obscure original URLs
•   Clean URLs
•   SEO (Seriously.)
•   Redirection
Uses

•   Obscure original URLs
•   Clean URLs
•   SEO (Seriously.)
•   Redirection
•   Access control
Where can I place rewrite
        rules?
Where can I place rewrite
            rules?
•   httpd.conf (or included config files)
Where can I place rewrite
            rules?
•   httpd.conf (or included config files)
•   VirtualHost
Where can I place rewrite
            rules?
•   httpd.conf (or included config files)
•   VirtualHost
•   Directory*
Where can I place rewrite
            rules?
•   httpd.conf (or included config files)
•   VirtualHost
•   Directory*
•   .htaccess
Where can I place rewrite
            rules?
•   httpd.conf (or included config files)
•   VirtualHost
•   Directory*
•   .htaccess


                  *Certain restrictions apply.**
Where can I place rewrite
            rules?
•   httpd.conf (or included config files)
•   VirtualHost
•   Directory*
•   .htaccess


                  *Certain restrictions apply.**
                         **Use .htaccess files
Directives
Directives
•   RewriteEngine
Directives
•   RewriteEngine
•   RewriteOptions
Directives
•   RewriteEngine
•   RewriteOptions
•   RewriteRule
Directives
•   RewriteEngine
•   RewriteOptions
•   RewriteRule
•   RewriteCond
Directives
•   RewriteEngine
•   RewriteOptions
•   RewriteRule
•   RewriteCond
•   RewriteLog
Directives
•   RewriteEngine
•   RewriteOptions
•   RewriteRule
•   RewriteCond
•   RewriteLog
•   RewriteBase
Directives
•   RewriteEngine
•   RewriteOptions
•   RewriteRule
•   RewriteCond
•   RewriteLog
•   RewriteBase
•   ...and more! (that we won’t cover)
Exhibit A

#   Default WordPress rewrite rules

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
Exhibit A, Explained
 #   Default WordPress rewrite rules

 # Turn rewrite engine on
 RewriteEngine On

 # Base all rewrites on ‘/’ URL
 RewriteBase /

 # If the requested file does not exist
 RewriteCond %{REQUEST_FILENAME} !-f

 # ...or if no directory exists...
 RewriteCond %{REQUEST_FILENAME} !-d

 # Rewrite the URL to /index.php
 RewriteRule . /index.php [L]
RewriteEngine on | off
RewriteEngine on | off


•   Enables or disables the runtime rewriting engine
RewriteEngine on | off


•   Enables or disables the runtime rewriting engine
•   Required inside VirtualHost and .htaccess
RewriteRule pattern substitution [flags]


•   Can occur more than once
•   Processed in order
•   First rule processed on URL path
•   Subsequent rules processed on previous output
    •   Think of chaining commands together in bash
RewriteRule pattern substitution [flags]
RewriteRule pattern substitution [flags]



•   PCRE (Perl-Compatible Regular Expressions)
RewriteRule pattern substitution [flags]



•   PCRE (Perl-Compatible Regular Expressions)
•   Matches the URL path
RewriteRule pattern substitution [flags]



•   PCRE (Perl-Compatible Regular Expressions)
•   Matches the URL path
•   RewriteCond required to match anything else
Regex



(?:(?:rn)?[ t])*(?:(?:(?:[^()<>@,;:".[]000-031]+(?:(?:(?:rn)?[ t])+|Z|(?=[["()<>@,;:
[t])*(?:[^()<>@,;:" .[] 000-031]+(?:(?:(?:rn)?[t])+|Z|(?=[["()<>@,;:".[]]))|[([^
[]r]|.)*](?:(?:rn)?[ t])*))*(?:,@(?:(?:rn)?[t])*(?:[^()<>@,;:". [] 000-031]+(?:
(?:(?:rn)?[t])+|Z|(?=[["()<>@,;:".[]]))|[([^[]r]|.)*](?:(?:rn)?[ t])*)(?:.(?:
(?:rn)?[t])*(?:[^()<>@,;:".[] 000-031]+(?:(?:(?:rn)?[t])+|Z|(?=[["()<>@,;:".[]]))|
[([^[]r]|.)*](?:(?:rn)?[ t])*))*)*:(?:(?:rn)?[t])*)?(?:[^()<>@,;:".[] 0 00-
031]+(?:(?:(?:rn)?[t])+|Z|(?=[["()<>@,;:".[]]))|"(?:[^"r]| .|(?:(?:rn)?[t]))*"(?:
(?:rn)?[ t])*)(?:.(?:(?:rn)?[ t])*(?:[^()<>@,;:".[] 000-031]+(?:(?:(?:rn)?[t])+|Z|
(?=[["()<>@,;:".[]]))|"(? :[^"r]|.|(?:(?:rn)?[t]))*"(?:(?:rn)?[ t])*))*@(?:(?:r
n)?[ t])* (?:[^()<>@,;:".[]000-031]+(?:(?:(?:rn)?[ t])+|Z|(?=[["()<>@,;:".[]]))|
[([^[]r]|.)*](?:(?:rn)?[ t])*)(?:.(?:(?:rn)?[t])*(?:[ ^()<>@,;:".[] 000-031]+
(?:(?:(?:rn)?[t])+|Z|(?=[["()<>@,;:".[]]))|[([^[]r]|.)*](?:(?:rn)?[ t])*))*
>(?:(?:rn)?[t])*)(?:,s*( ?:(?:[^()<>@,;:".[] 000-031]+(?:(?:(?:rn)?[t])+|Z|(?=[
["()<>@,;: ".[]]))|"(?:[^"r]|.|(?:(?:rn)?[t]))*"(?:(?:rn)?[ t])*)(?:.(?:( ?:rn)?
[t])*(?:[^()<>@,;:".[] 000-031]+(?:(?:(?:rn)?[ t])+|Z|(?=[["()<>@,;:".[]]))|"(?:[^
"r]|.|(?:(?:rn)?[t]))*"(?:(?:rn)?[ t ])*))*@(?:(?:rn)?[ t])*(?:[^()<>@,;:".[]
000-031]+(?:(?:(?:rn)?[ t])+|Z|(?=[["()<>@,;:".[]]))|[([^[]r]|.)*](?:(?:rn)?



                                         Regex
[t])*)(? :.(?:(?:rn)?[ t])*(?:[^()<>@,;:".[]000-031]+(?:(?:(?:rn)?[ t])+|Z|(?=[
["()<>@,;:".[]]))|[([^[]r]|.)*](?:(?:rn)?[t])*))*|(?: [^()<>@,;:".[] 000-031]+
(?:(?:(?:rn)?[t])+|Z|(?=[["()<>@,;:".[ ]]))|"(?:[^"r]|.|(?:(?:rn)?[t]))*"(?:(?:r
n)?[ t])*)*<(?:(?:rn) ?[t])*(?:@(?:[^()<>@,;:".[] 000-031]+(?:(?:(?:rn)?[t])+|Z|(?
=[["()<>@,;:".[]]))|[([^[]r]|.)*](?:(?:rn)?[t])*)(?:.(?:(?:rn) ?[ t])*(?:
[^()<>@,;:".[]000-031]+(?:(?:(?:rn)?[ t])+|Z|(?=[["()<>@,;:".[]]))|[([^[]r]|
.)*](?:(?:rn)?[t])*))*(?:,@(?:(?:rn)?[ t])*(?:[^()<>@,;:".[]000-031]+(?:(?:(?:rn)?
[ t])+|Z|(?=[["()<>@,;:".[]]))|[([^[]r]|.)*](?:(?:rn)?[t])*)(?:.(?:(?:rn)?
[ t] )*(?:[^()<>@,;:".[]000-031]+(?:(?:(?:rn)?[ t])+|Z|(?=[["()<>@,;:".[]]))|[([^
[]r]|.)*](?:(?:rn)?[ t])*))*)*:(?:(?:rn)?[t])*)? (?:[^()<>@,;:".[] 000-031]+(?:
(?:(?:rn)?[t])+|Z|(?=[["()<>@,;:". []]))|"(?:[^"r]|.|(?:(?:rn)?[t]))*"(?:(?:rn)?
[ t])*)(?:.(?:(?: rn)?[t])*(?:[^()<>@,;:".[] 000-031]+(?:(?:(?:rn)?[ t])+|Z|(?=[
["()<>@,;:".[]]))|"(?:[^"r]|.|(?:(?:rn)?[t]))*"(?:(?:rn)?[ t]) *))*@(?:(?:rn)?
[ t])*(?:[^()<>@,;:".[]000-031]+(?:(?:(?:rn)?[ t])+|Z|(?=[["()<>@,;:".[]]))|[([^
[]r]|.)*](?:(?:rn)?[t])*)(?: .(?:(?:rn)?[ t])*(?:[^()<>@,;:".[]000-031]+(?:(?:
(?:rn)?[ t])+|Z|(?=[["()<>@,;:".[]]))|[([^[]r]|.)*](?:(?:rn)?[t])*))*>(?:( ?:
rn)?[ t])*))*)?;s*)
[t])*(?:[^()<>@,;:" .[] 000-031]+(?:(?:(?:rn)?[t])+|Z|(?=[["()<>@,;:".[]]))|[([^
[]r]|.)*](?:(?:rn)?[ t])*))*(?:,@(?:(?:rn)?[t])*(?:[^()<>@,;:". [] 000-031]+(?:
(?:(?:rn)?[t])+|Z|(?=[["()<>@,;:".[]]))|[([^[]r]|.)*](?:(?:rn)?[ t])*)(?:.(?:
(?:rn)?[t])*(?:[^()<>@,;:".[] 000-031]+(?:(?:(?:rn)?[t])+|Z|(?=[["()<>@,;:".[]]))|
[([^[]r]|.)*](?:(?:rn)?[ t])*))*)*:(?:(?:rn)?[t])*)?(?:[^()<>@,;:".[] 0 00-
031]+(?:(?:(?:rn)?[t])+|Z|(?=[["()<>@,;:".[]]))|"(?:[^"r]| .|(?:(?:rn)?[t]))*"(?:
(?:rn)?[ t])*)(?:.(?:(?:rn)?[ t])*(?:[^()<>@,;:".[] 000-031]+(?:(?:(?:rn)?[t])+|Z|
(?=[["()<>@,;:".[]]))|"(? :[^"r]|.|(?:(?:rn)?[t]))*"(?:(?:rn)?[ t])*))*@(?:(?:r
n)?[ t])* (?:[^()<>@,;:".[]000-031]+(?:(?:(?:rn)?[ t])+|Z|(?=[["()<>@,;:".[]]))|
[([^[]r]|.)*](?:(?:rn)?[ t])*)(?:.(?:(?:rn)?[t])*(?:[ ^()<>@,;:".[] 000-031]+
(?:(?:(?:rn)?[t])+|Z|(?=[["()<>@,;:".[]]))|[([^[]r]|.)*](?:(?:rn)?[ t])*))*
>(?:(?:rn)?[t])*)(?:,s*( ?:(?:[^()<>@,;:".[] 000-031]+(?:(?:(?:rn)?[t])+|Z|(?=[
["()<>@,;: ".[]]))|"(?:[^"r]|.|(?:(?:rn)?[t]))*"(?:(?:rn)?[ t])*)(?:.(?:( ?:rn)?
[t])*(?:[^()<>@,;:".[] 000-031]+(?:(?:(?:rn)?[ t])+|Z|(?=[["()<>@,;:".[]]))|"(?:[^
"r]|.|(?:(?:rn)?[t]))*"(?:(?:rn)?[ t ])*))*@(?:(?:rn)?[ t])*(?:[^()<>@,;:".[]
000-031]+(?:(?:(?:rn)?[ t])+|Z|(?=[["()<>@,;:".[]]))|[([^[]r]|.)*](?:(?:rn)?



                                         Regex
[t])*)(? :.(?:(?:rn)?[ t])*(?:[^()<>@,;:".[]000-031]+(?:(?:(?:rn)?[ t])+|Z|(?=[
["()<>@,;:".[]]))|[([^[]r]|.)*](?:(?:rn)?[t])*))*|(?: [^()<>@,;:".[] 000-031]+
(?:(?:(?:rn)?[t])+|Z|(?=[["()<>@,;:".[ ]]))|"(?:[^"r]|.|(?:(?:rn)?[t]))*"(?:(?:r
n)?[ t])*)*<(?:(?:rn) ?[t])*(?:@(?:[^()<>@,;:".[] 000-031]+(?:(?:(?:rn)?[t])+|Z|(?
=[["()<>@,;:".[]]))|[([^[]r]|.)*](?:(?:rn)?[t])*)(?:.(?:(?:rn) ?[ t])*(?:
[^()<>@,;:".[]000-031]+(?:(?:(?:rn)?[ t])+|Z|(?=[["()<>@,;:".[]]))|[([^[]r]|
.)*](?:(?:rn)?[t])*))*(?:,@(?:(?:rn)?[ t])*(?:[^()<>@,;:".[]000-031]+(?:(?:(?:rn)?
[ t])+|Z|(?=[["()<>@,;:".[]]))|[([^[]r]|.)*](?:(?:rn)?[t])*)(?:.(?:(?:rn)?
[ t] )*(?:[^()<>@,;:".[]000-031]+(?:(?:(?:rn)?[ t])+|Z|(?=[["()<>@,;:".[]]))|[([^
[]r]|.)*](?:(?:rn)?[ t])*))*)*:(?:(?:rn)?[t])*)? (?:[^()<>@,;:".[] 000-031]+(?:
(?:(?:rn)?[t])+|Z|(?=[["()<>@,;:". []]))|"(?:[^"r]|.|(?:(?:rn)?[t]))*"(?:(?:rn)?
[ t])*)(?:.(?:(?: rn)?[t])*(?:[^()<>@,;:".[] 000-031]+(?:(?:(?:rn)?[ t])+|Z|(?=[
["()<>@,;:".[]]))|"(?:[^"r]|.|(?:(?:rn)?[t]))*"(?:(?:rn)?[ t]) *))*@(?:(?:rn)?
[ t])*(?:[^()<>@,;:".[]000-031]+(?:(?:(?:rn)?[ t])+|Z|(?=[["()<>@,;:".[]]))|[([^
[]r]|.)*](?:(?:rn)?[t])*)(?: .(?:(?:rn)?[ t])*(?:[^()<>@,;:".[]000-031]+(?:(?:

                (RFC 822 Compliant Email Validation)
(?:rn)?[ t])+|Z|(?=[["()<>@,;:".[]]))|[([^[]r]|.)*](?:(?:rn)?[t])*))*>(?:( ?:
rn)?[ t])*))*)?;s*)
Regex          ®

It’s Not That Hard™
RewriteRule pattern substitution [flags]
RewriteRule pattern substitution [flags]


Can be one of several things:
RewriteRule pattern substitution [flags]


Can be one of several things:
 •   file-system path
RewriteRule pattern substitution [flags]


Can be one of several things:
 •   file-system path
 •   URL path
RewriteRule pattern substitution [flags]


Can be one of several things:
 •   file-system path
 •   URL path
 •   Absolute URL
RewriteRule pattern substitution [flags]


Can be one of several things:
 •   file-system path
 •   URL path
 •   Absolute URL
 •   - [dash]   (no substitution)
RewriteRule pattern substitution [flags]
RewriteRule pattern substitution [flags]

•   Affect behavior of the Rule or Condition
RewriteRule pattern substitution [flags]

•   Affect behavior of the Rule or Condition
•   Contained in square brackets
RewriteRule pattern substitution [flags]

•   Affect behavior of the Rule or Condition
•   Contained in square brackets
•   Comma-separated
RewriteRule pattern substitution [flags]

•   Affect behavior of the Rule or Condition
•   Contained in square brackets     [NC]
•   Comma-separated
RewriteRule pattern substitution [flags]

•   Affect behavior of the Rule or Condition
•   Contained in square brackets      [NC]
•   Comma-separated                [NC, QSA, L]
RewriteRule pattern substitution [flags]
RewriteRule pattern substitution [flags]
          C    Chain this rule to the next rule
          E    Set environment variable
           F   403 Forbidden Status
          G    410 Gone Status
          H    Specify handler
          L    Don’t process rules after this one
        NC     Case-insensitive
       QSA     Append query string
     R[=301]   Redirect (R=HTTP Status Code)
RewriteRule pattern substitution [flags]
          C    Chain this rule to the next rule
          E    Set environment variable
           F   403 Forbidden Status
          G    410 Gone Status
          H    Specify handler
          L    Don’t process rules after this one
        NC     Case-insensitive
       QSA     Append query string
     R[=301]   Redirect (R=HTTP Status Code)
RewriteRule pattern substitution [flags]
          C    Chain this rule to the next rule
          E    Set environment variable
           F   403 Forbidden Status
          G    410 Gone Status
          H    Specify handler
          L    Don’t process rules after this one
        NC     Case-insensitive
       QSA     Append query string
     R[=301]   Redirect (R=HTTP Status Code)
RewriteRule pattern substitution [flags]
          C    Chain this rule to the next rule
          E    Set environment variable
           F   403 Forbidden Status
          G    410 Gone Status
          H    Specify handler
          L    Don’t process rules after this one
        NC     Case-insensitive
       QSA     Append query string
     R[=301]   Redirect (R=HTTP Status Code)
RewriteRule pattern substitution [flags]
          C    Chain this rule to the next rule
          E    Set environment variable
           F   403 Forbidden Status
          G    410 Gone Status
          H    Specify handler
          L    Don’t process rules after this one
        NC     Case-insensitive
       QSA     Append query string
     R[=301]   Redirect (R=HTTP Status Code)
RewriteRule pattern substitution [flags]
          C    Chain this rule to the next rule
          E    Set environment variable
           F   403 Forbidden Status
          G    410 Gone Status
          H    Specify handler
          L    Don’t process rules after this one
        NC     Case-insensitive
       QSA     Append query string
     R[=301]   Redirect (R=HTTP Status Code)
RewriteRule pattern substitution [flags]
          C    Chain this rule to the next rule
          E    Set environment variable
           F   403 Forbidden Status
          G    410 Gone Status
          H    Specify handler
          L    Don’t process rules after this one
        NC     Case-insensitive
       QSA     Append query string
     R[=301]   Redirect (R=HTTP Status Code)
RewriteRule pattern substitution [flags]
          C    Chain this rule to the next rule
          E    Set environment variable
           F   403 Forbidden Status
          G    410 Gone Status
          H    Specify handler
          L    Don’t process rules after this one
        NC     Case-insensitive
       QSA     Append query string
     R[=301]   Redirect (R=HTTP Status Code)
RewriteRule pattern substitution [flags]
          C    Chain this rule to the next rule
          E    Set environment variable
           F   403 Forbidden Status
          G    410 Gone Status
          H    Specify handler
          L    Don’t process rules after this one
        NC     Case-insensitive
       QSA     Append query string
     R[=301]   Redirect (R=HTTP Status Code)
RewriteCond variable pattern [flags]


•    HTTP Server Variables (HTTP_HOST, REQUEST_URI)
•    Pattern that must match the given variable
•    Optional flags that change the behavior, just like
     RewriteRule
RewriteCond variable pattern [flags]
RewriteCond variable pattern [flags]
            HTTP_REFERER

             HTTP_HOST

            REMOTE_ADDR

           REQUEST_METHOD

             SERVER_PORT

           HTTP_USER_AGENT

             REQUEST_URI

                 etc.
RewriteCond variable pattern [flags]
            HTTP_REFERER

             HTTP_HOST

            REMOTE_ADDR

           REQUEST_METHOD

             SERVER_PORT

           HTTP_USER_AGENT

             REQUEST_URI

                 etc.
RewriteCond variable pattern [flags]
            HTTP_REFERER

             HTTP_HOST

            REMOTE_ADDR

           REQUEST_METHOD

             SERVER_PORT

           HTTP_USER_AGENT

             REQUEST_URI

                 etc.
RewriteCond variable pattern [flags]
            HTTP_REFERER

             HTTP_HOST

            REMOTE_ADDR

           REQUEST_METHOD

             SERVER_PORT

           HTTP_USER_AGENT

             REQUEST_URI

                 etc.
RewriteCond variable pattern [flags]
            HTTP_REFERER

             HTTP_HOST

            REMOTE_ADDR

           REQUEST_METHOD

             SERVER_PORT

           HTTP_USER_AGENT

             REQUEST_URI

                 etc.
RewriteCond variable pattern [flags]
            HTTP_REFERER

             HTTP_HOST

            REMOTE_ADDR

           REQUEST_METHOD

             SERVER_PORT

           HTTP_USER_AGENT

             REQUEST_URI

                 etc.
RewriteCond variable pattern [flags]
            HTTP_REFERER

             HTTP_HOST

            REMOTE_ADDR

           REQUEST_METHOD

             SERVER_PORT

           HTTP_USER_AGENT

             REQUEST_URI

                 etc.
RewriteCond variable pattern [flags]
            HTTP_REFERER

             HTTP_HOST

            REMOTE_ADDR

           REQUEST_METHOD

             SERVER_PORT

           HTTP_USER_AGENT

             REQUEST_URI

                 etc.
Exhibit A, Explained (Again)
     #   Default WordPress rewrite rules

     # Turn rewrite engine on
     RewriteEngine On

     # Base all rewrites on ‘/’ URL
     RewriteBase /

     # If the requested file does not exist
     RewriteCond %{REQUEST_FILENAME} !-f

     # ...or if no directory exists...
     RewriteCond %{REQUEST_FILENAME} !-d

     # Rewrite the URL to /index.php
     RewriteRule . /index.php [L]
non-www to www
RewriteEngine On
RewriteCond %{HTTP_HOST} ^example.com$ [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]




        Pattern                               Flags
                        Substitution
non-www to www
RewriteEngine On
RewriteCond %{HTTP_HOST} ^example.com$ [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]




      Match this pattern
      Pattern inside parentheses
      is capture as variable ‘$1’
non-www to www
RewriteEngine On
RewriteCond %{HTTP_HOST} ^example.com$ [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]




         Substitute it with “http://www.example.com”
non-www to www
RewriteEngine On
RewriteCond %{HTTP_HOST} ^example.com$ [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]




                    The pattern captured
                   inside the parentheses
non-www to www
RewriteEngine On
RewriteCond %{HTTP_HOST} ^example.com$ [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]
non-www to www
RewriteEngine On
RewriteCond %{HTTP_HOST} ^example.com$ [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]



                           Redirect with a 301 Code
non-www to www
RewriteEngine On
RewriteCond %{HTTP_HOST} ^example.com$ [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]




                               Make this the last RewriteRule
RewriteOptions inherit
RewriteOptions inherit

•   Inherit the configuration of the parent
RewriteOptions inherit

•   Inherit the configuration of the parent
•   In per-virtual-server context, maps, conditions and rules
    of the main server are inherited
RewriteOptions inherit

•   Inherit the configuration of the parent
•   In per-virtual-server context, maps, conditions and rules
    of the main server are inherited
•   In per-directory context, conditions and rules of the
    parent directory's .htaccess configuration are inherited
Example
Example
in httpd.conf
Example
 in httpd.conf
...


RewriteRule ^(.*)$ index.php

...


<VirtualHost 192.168.1.120:80>
   ServerName zomgbacon.com
   DocumentRoot /home/bacon/public_html

   # Turn on the rewrite engine and inherit any rules
   RewriteEngine On
   RewriteOptions Inherit
</VirtualHost>

...
RewriteBase URL-path
RewriteBase URL-path


•   Sets the base URL for per-directory rewrites
RewriteBase URL-path


•   Sets the base URL for per-directory rewrites
•   URLs are NOT directly related to physical filename
    paths
RewriteBase Example
RewriteBase Example
in .htaccess file
RewriteBase Example
in .htaccess file
#
#   /abc/def/.htaccess -- per-dir config file for directory /abc/def
#   Remember: /abc/def is the physical path of /xyz, i.e., the server
#             has a 'Alias /xyz /abc/def' directive e.g.
#

RewriteEngine On

# let the server know that we were reached via /xyz and not
# via the physical path prefix /abc/def
RewriteBase  /xyz

# now the rewriting rules
RewriteRule  ^oldstuff.html$   newstuff.html
RewriteLog log-path
RewriteLog log-path

•   Logs rewrites
RewriteLog log-path

•   Logs rewrites
•   Level of logging can be tuned
RewriteLog log-path

•   Logs rewrites
•   Level of logging can be tuned
•   Relative paths are relative to DocumentRoot
RewriteLog log-path

•   Logs rewrites
•   Level of logging can be tuned
•   Relative paths are relative to DocumentRoot
•   Absolute paths are...well, absolute.
RewriteLogLevel level
RewriteLogLevel level

•   Integer value 0-9
RewriteLogLevel level

•   Integer value 0-9
•   0 == disabled
RewriteLogLevel level

•   Integer value 0-9
•   0 == disabled
•   9 == log nearly everything
RewriteLogLevel level

•   Integer value 0-9
•   0 == disabled
•   9 == log nearly everything
•   More verbose, greater impact on performance
RewriteLogLevel level

•   Integer value 0-9
•   0 == disabled
•   9 == log nearly everything
•   More verbose, greater impact on performance
•   Higher levels == 2 or higher for debugging only
Logging Examples
Logging Examples
in httpd.conf
Logging Examples
 in httpd.conf
...


<VirtualHost 192.168.1.120:80>
ServerName zomgbacon.com
DocumentRoot /home/bacon/public_html

# /home/bacon/public_html/rewrite.log
RewriteLog rewrite.log

# Make it semi-verbose
RewriteLogLevel 5

# turn on rewrite engine and inherit rules
RewriteEngine on
RewriteOptions Inherit
</VirtualHost>

...
fin

More Related Content

What's hot

[2D1]Elasticsearch 성능 최적화
[2D1]Elasticsearch 성능 최적화[2D1]Elasticsearch 성능 최적화
[2D1]Elasticsearch 성능 최적화NAVER D2
 
Rhebok, High Performance Rack Handler / Rubykaigi 2015
Rhebok, High Performance Rack Handler / Rubykaigi 2015Rhebok, High Performance Rack Handler / Rubykaigi 2015
Rhebok, High Performance Rack Handler / Rubykaigi 2015Masahiro Nagano
 
A simple introduction to redis
A simple introduction to redisA simple introduction to redis
A simple introduction to redisZhichao Liang
 
Administering and Monitoring SolrCloud Clusters
Administering and Monitoring SolrCloud ClustersAdministering and Monitoring SolrCloud Clusters
Administering and Monitoring SolrCloud ClustersSematext Group, Inc.
 
今時なウェブ開発をSmalltalkでやってみる?
今時なウェブ開発をSmalltalkでやってみる?今時なウェブ開発をSmalltalkでやってみる?
今時なウェブ開発をSmalltalkでやってみる?Sho Yoshida
 
A Brief Introduction to Redis
A Brief Introduction to RedisA Brief Introduction to Redis
A Brief Introduction to RedisCharles Anderson
 
Most common mistakes of workshops applicants
Most common mistakes of workshops applicantsMost common mistakes of workshops applicants
Most common mistakes of workshops applicantsDominik Wojciechowski
 
Spring data iii
Spring data iiiSpring data iii
Spring data iii명철 강
 
Understanding git: Voxxed Vienna 2016
Understanding git: Voxxed Vienna 2016Understanding git: Voxxed Vienna 2016
Understanding git: Voxxed Vienna 2016Steve Smith
 
BuildStuff.LT 2018 InSpec Workshop
BuildStuff.LT 2018 InSpec WorkshopBuildStuff.LT 2018 InSpec Workshop
BuildStuff.LT 2018 InSpec WorkshopMandi Walls
 

What's hot (15)

[2D1]Elasticsearch 성능 최적화
[2D1]Elasticsearch 성능 최적화[2D1]Elasticsearch 성능 최적화
[2D1]Elasticsearch 성능 최적화
 
Hadoop 설치
Hadoop 설치Hadoop 설치
Hadoop 설치
 
AssertJ quick introduction
AssertJ quick introductionAssertJ quick introduction
AssertJ quick introduction
 
Rhebok, High Performance Rack Handler / Rubykaigi 2015
Rhebok, High Performance Rack Handler / Rubykaigi 2015Rhebok, High Performance Rack Handler / Rubykaigi 2015
Rhebok, High Performance Rack Handler / Rubykaigi 2015
 
Refactoring Infrastructure Code
Refactoring Infrastructure CodeRefactoring Infrastructure Code
Refactoring Infrastructure Code
 
A simple introduction to redis
A simple introduction to redisA simple introduction to redis
A simple introduction to redis
 
Administering and Monitoring SolrCloud Clusters
Administering and Monitoring SolrCloud ClustersAdministering and Monitoring SolrCloud Clusters
Administering and Monitoring SolrCloud Clusters
 
今時なウェブ開発をSmalltalkでやってみる?
今時なウェブ開発をSmalltalkでやってみる?今時なウェブ開発をSmalltalkでやってみる?
今時なウェブ開発をSmalltalkでやってみる?
 
A Brief Introduction to Redis
A Brief Introduction to RedisA Brief Introduction to Redis
A Brief Introduction to Redis
 
mod_rewrite
mod_rewritemod_rewrite
mod_rewrite
 
Most common mistakes of workshops applicants
Most common mistakes of workshops applicantsMost common mistakes of workshops applicants
Most common mistakes of workshops applicants
 
Spring data iii
Spring data iiiSpring data iii
Spring data iii
 
Understanding git: Voxxed Vienna 2016
Understanding git: Voxxed Vienna 2016Understanding git: Voxxed Vienna 2016
Understanding git: Voxxed Vienna 2016
 
BuildStuff.LT 2018 InSpec Workshop
BuildStuff.LT 2018 InSpec WorkshopBuildStuff.LT 2018 InSpec Workshop
BuildStuff.LT 2018 InSpec Workshop
 
Picconf12
Picconf12Picconf12
Picconf12
 

Viewers also liked

Apache - Mod-Rewrite
Apache - Mod-RewriteApache - Mod-Rewrite
Apache - Mod-RewriteMarakana Inc.
 
mod_rewrite bootcamp, Ohio LInux 2011
mod_rewrite bootcamp, Ohio LInux 2011mod_rewrite bootcamp, Ohio LInux 2011
mod_rewrite bootcamp, Ohio LInux 2011Rich Bowen
 
TO ADD NEW URL REWRITE RULE IN WORDPRESS
TO ADD NEW URL REWRITE RULE IN WORDPRESSTO ADD NEW URL REWRITE RULE IN WORDPRESS
TO ADD NEW URL REWRITE RULE IN WORDPRESSTheCreativedev Blog
 
Apache Rewrite Rules
Apache Rewrite RulesApache Rewrite Rules
Apache Rewrite RulesAkhil Bansal
 
UTF-8: The Secret of Character Encoding
UTF-8: The Secret of Character EncodingUTF-8: The Secret of Character Encoding
UTF-8: The Secret of Character EncodingBert Pattyn
 

Viewers also liked (6)

mod_rewrite
mod_rewritemod_rewrite
mod_rewrite
 
Apache - Mod-Rewrite
Apache - Mod-RewriteApache - Mod-Rewrite
Apache - Mod-Rewrite
 
mod_rewrite bootcamp, Ohio LInux 2011
mod_rewrite bootcamp, Ohio LInux 2011mod_rewrite bootcamp, Ohio LInux 2011
mod_rewrite bootcamp, Ohio LInux 2011
 
TO ADD NEW URL REWRITE RULE IN WORDPRESS
TO ADD NEW URL REWRITE RULE IN WORDPRESSTO ADD NEW URL REWRITE RULE IN WORDPRESS
TO ADD NEW URL REWRITE RULE IN WORDPRESS
 
Apache Rewrite Rules
Apache Rewrite RulesApache Rewrite Rules
Apache Rewrite Rules
 
UTF-8: The Secret of Character Encoding
UTF-8: The Secret of Character EncodingUTF-8: The Secret of Character Encoding
UTF-8: The Secret of Character Encoding
 

Similar to mod_rewrite

Introduction to Infrastructure as Code & Automation / Introduction to Chef
Introduction to Infrastructure as Code & Automation / Introduction to ChefIntroduction to Infrastructure as Code & Automation / Introduction to Chef
Introduction to Infrastructure as Code & Automation / Introduction to ChefAll Things Open
 
Introduction To PHP
Introduction To PHPIntroduction To PHP
Introduction To PHPShweta A
 
Hardcore URL Routing for WordPress - WordCamp Atlanta 2014 (PPT)
Hardcore URL Routing for WordPress - WordCamp Atlanta 2014 (PPT)Hardcore URL Routing for WordPress - WordCamp Atlanta 2014 (PPT)
Hardcore URL Routing for WordPress - WordCamp Atlanta 2014 (PPT)Mike Schinkel
 
Масштабируемая конфигурация Nginx, Игорь Сысоев (Nginx)
Масштабируемая конфигурация Nginx, Игорь Сысоев (Nginx)Масштабируемая конфигурация Nginx, Игорь Сысоев (Nginx)
Масштабируемая конфигурация Nginx, Игорь Сысоев (Nginx)Ontico
 
Synapseindia reviews sharing intro cakephp
Synapseindia reviews sharing intro cakephpSynapseindia reviews sharing intro cakephp
Synapseindia reviews sharing intro cakephpSynapseindiaComplaints
 
Nginx A High Performance Load Balancer, Web Server & Reverse Proxy
Nginx A High Performance Load Balancer, Web Server & Reverse ProxyNginx A High Performance Load Balancer, Web Server & Reverse Proxy
Nginx A High Performance Load Balancer, Web Server & Reverse ProxyAmit Aggarwal
 
Apache mod_rewrite
Apache mod_rewriteApache mod_rewrite
Apache mod_rewriteDave Ross
 
Crafting Beautiful CLI Applications in Ruby
Crafting Beautiful CLI Applications in RubyCrafting Beautiful CLI Applications in Ruby
Crafting Beautiful CLI Applications in RubyNikhil Mungel
 
Heritrix DecideRules
Heritrix DecideRulesHeritrix DecideRules
Heritrix DecideRulesRoger Coram
 
Web Development with Python and Django
Web Development with Python and DjangoWeb Development with Python and Django
Web Development with Python and DjangoMichael Pirnat
 
Coder Presentation Szeged
Coder Presentation SzegedCoder Presentation Szeged
Coder Presentation SzegedDoug Green
 
Introduction to Infrastructure as Code & Automation / Introduction to Chef
Introduction to Infrastructure as Code & Automation / Introduction to ChefIntroduction to Infrastructure as Code & Automation / Introduction to Chef
Introduction to Infrastructure as Code & Automation / Introduction to ChefNathen Harvey
 
Refactoring Applications using SOLID Principles
Refactoring Applications using SOLID PrinciplesRefactoring Applications using SOLID Principles
Refactoring Applications using SOLID PrinciplesSteven Smith
 
Jasig rubyon rails
Jasig rubyon railsJasig rubyon rails
Jasig rubyon rails_zaMmer_
 
Jasig rubyon rails
Jasig rubyon railsJasig rubyon rails
Jasig rubyon rails_zaMmer_
 

Similar to mod_rewrite (20)

Introduction to Infrastructure as Code & Automation / Introduction to Chef
Introduction to Infrastructure as Code & Automation / Introduction to ChefIntroduction to Infrastructure as Code & Automation / Introduction to Chef
Introduction to Infrastructure as Code & Automation / Introduction to Chef
 
Introduction To PHP
Introduction To PHPIntroduction To PHP
Introduction To PHP
 
Hardcore URL Routing for WordPress - WordCamp Atlanta 2014 (PPT)
Hardcore URL Routing for WordPress - WordCamp Atlanta 2014 (PPT)Hardcore URL Routing for WordPress - WordCamp Atlanta 2014 (PPT)
Hardcore URL Routing for WordPress - WordCamp Atlanta 2014 (PPT)
 
Масштабируемая конфигурация Nginx, Игорь Сысоев (Nginx)
Масштабируемая конфигурация Nginx, Игорь Сысоев (Nginx)Масштабируемая конфигурация Nginx, Игорь Сысоев (Nginx)
Масштабируемая конфигурация Nginx, Игорь Сысоев (Nginx)
 
Nginx
NginxNginx
Nginx
 
Synapseindia reviews sharing intro cakephp
Synapseindia reviews sharing intro cakephpSynapseindia reviews sharing intro cakephp
Synapseindia reviews sharing intro cakephp
 
Nginx A High Performance Load Balancer, Web Server & Reverse Proxy
Nginx A High Performance Load Balancer, Web Server & Reverse ProxyNginx A High Performance Load Balancer, Web Server & Reverse Proxy
Nginx A High Performance Load Balancer, Web Server & Reverse Proxy
 
Apache mod_rewrite
Apache mod_rewriteApache mod_rewrite
Apache mod_rewrite
 
Crafting Beautiful CLI Applications in Ruby
Crafting Beautiful CLI Applications in RubyCrafting Beautiful CLI Applications in Ruby
Crafting Beautiful CLI Applications in Ruby
 
Heritrix DecideRules
Heritrix DecideRulesHeritrix DecideRules
Heritrix DecideRules
 
Web Development with Python and Django
Web Development with Python and DjangoWeb Development with Python and Django
Web Development with Python and Django
 
Coder Presentation Szeged
Coder Presentation SzegedCoder Presentation Szeged
Coder Presentation Szeged
 
Common scenarios in vcl
Common scenarios in vclCommon scenarios in vcl
Common scenarios in vcl
 
Introduction to Chef
Introduction to ChefIntroduction to Chef
Introduction to Chef
 
Introduction to Infrastructure as Code & Automation / Introduction to Chef
Introduction to Infrastructure as Code & Automation / Introduction to ChefIntroduction to Infrastructure as Code & Automation / Introduction to Chef
Introduction to Infrastructure as Code & Automation / Introduction to Chef
 
Refactoring Applications using SOLID Principles
Refactoring Applications using SOLID PrinciplesRefactoring Applications using SOLID Principles
Refactoring Applications using SOLID Principles
 
Chef introduction
Chef introductionChef introduction
Chef introduction
 
Git introduction
Git introductionGit introduction
Git introduction
 
Jasig rubyon rails
Jasig rubyon railsJasig rubyon rails
Jasig rubyon rails
 
Jasig rubyon rails
Jasig rubyon railsJasig rubyon rails
Jasig rubyon rails
 

Recently uploaded

Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rick Flair
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxBkGupta21
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...AliaaTarek5
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 

Recently uploaded (20)

Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptx
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 

mod_rewrite

  • 3. Uses • Obscure original URLs
  • 4. Uses • Obscure original URLs • Clean URLs
  • 5. Uses • Obscure original URLs • Clean URLs • SEO (Seriously.)
  • 6. Uses • Obscure original URLs • Clean URLs • SEO (Seriously.) • Redirection
  • 7. Uses • Obscure original URLs • Clean URLs • SEO (Seriously.) • Redirection • Access control
  • 8. Where can I place rewrite rules?
  • 9. Where can I place rewrite rules? • httpd.conf (or included config files)
  • 10. Where can I place rewrite rules? • httpd.conf (or included config files) • VirtualHost
  • 11. Where can I place rewrite rules? • httpd.conf (or included config files) • VirtualHost • Directory*
  • 12. Where can I place rewrite rules? • httpd.conf (or included config files) • VirtualHost • Directory* • .htaccess
  • 13. Where can I place rewrite rules? • httpd.conf (or included config files) • VirtualHost • Directory* • .htaccess *Certain restrictions apply.**
  • 14. Where can I place rewrite rules? • httpd.conf (or included config files) • VirtualHost • Directory* • .htaccess *Certain restrictions apply.** **Use .htaccess files
  • 16. Directives • RewriteEngine
  • 17. Directives • RewriteEngine • RewriteOptions
  • 18. Directives • RewriteEngine • RewriteOptions • RewriteRule
  • 19. Directives • RewriteEngine • RewriteOptions • RewriteRule • RewriteCond
  • 20. Directives • RewriteEngine • RewriteOptions • RewriteRule • RewriteCond • RewriteLog
  • 21. Directives • RewriteEngine • RewriteOptions • RewriteRule • RewriteCond • RewriteLog • RewriteBase
  • 22. Directives • RewriteEngine • RewriteOptions • RewriteRule • RewriteCond • RewriteLog • RewriteBase • ...and more! (that we won’t cover)
  • 23. Exhibit A # Default WordPress rewrite rules RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L]
  • 24. Exhibit A, Explained # Default WordPress rewrite rules # Turn rewrite engine on RewriteEngine On # Base all rewrites on ‘/’ URL RewriteBase / # If the requested file does not exist RewriteCond %{REQUEST_FILENAME} !-f # ...or if no directory exists... RewriteCond %{REQUEST_FILENAME} !-d # Rewrite the URL to /index.php RewriteRule . /index.php [L]
  • 26. RewriteEngine on | off • Enables or disables the runtime rewriting engine
  • 27. RewriteEngine on | off • Enables or disables the runtime rewriting engine • Required inside VirtualHost and .htaccess
  • 28. RewriteRule pattern substitution [flags] • Can occur more than once • Processed in order • First rule processed on URL path • Subsequent rules processed on previous output • Think of chaining commands together in bash
  • 30. RewriteRule pattern substitution [flags] • PCRE (Perl-Compatible Regular Expressions)
  • 31. RewriteRule pattern substitution [flags] • PCRE (Perl-Compatible Regular Expressions) • Matches the URL path
  • 32. RewriteRule pattern substitution [flags] • PCRE (Perl-Compatible Regular Expressions) • Matches the URL path • RewriteCond required to match anything else
  • 34. [t])*(?:[^()<>@,;:" .[] 000-031]+(?:(?:(?:rn)?[t])+|Z|(?=[["()<>@,;:".[]]))|[([^ []r]|.)*](?:(?:rn)?[ t])*))*(?:,@(?:(?:rn)?[t])*(?:[^()<>@,;:". [] 000-031]+(?: (?:(?:rn)?[t])+|Z|(?=[["()<>@,;:".[]]))|[([^[]r]|.)*](?:(?:rn)?[ t])*)(?:.(?: (?:rn)?[t])*(?:[^()<>@,;:".[] 000-031]+(?:(?:(?:rn)?[t])+|Z|(?=[["()<>@,;:".[]]))| [([^[]r]|.)*](?:(?:rn)?[ t])*))*)*:(?:(?:rn)?[t])*)?(?:[^()<>@,;:".[] 0 00- 031]+(?:(?:(?:rn)?[t])+|Z|(?=[["()<>@,;:".[]]))|"(?:[^"r]| .|(?:(?:rn)?[t]))*"(?: (?:rn)?[ t])*)(?:.(?:(?:rn)?[ t])*(?:[^()<>@,;:".[] 000-031]+(?:(?:(?:rn)?[t])+|Z| (?=[["()<>@,;:".[]]))|"(? :[^"r]|.|(?:(?:rn)?[t]))*"(?:(?:rn)?[ t])*))*@(?:(?:r n)?[ t])* (?:[^()<>@,;:".[]000-031]+(?:(?:(?:rn)?[ t])+|Z|(?=[["()<>@,;:".[]]))| [([^[]r]|.)*](?:(?:rn)?[ t])*)(?:.(?:(?:rn)?[t])*(?:[ ^()<>@,;:".[] 000-031]+ (?:(?:(?:rn)?[t])+|Z|(?=[["()<>@,;:".[]]))|[([^[]r]|.)*](?:(?:rn)?[ t])*))* >(?:(?:rn)?[t])*)(?:,s*( ?:(?:[^()<>@,;:".[] 000-031]+(?:(?:(?:rn)?[t])+|Z|(?=[ ["()<>@,;: ".[]]))|"(?:[^"r]|.|(?:(?:rn)?[t]))*"(?:(?:rn)?[ t])*)(?:.(?:( ?:rn)? [t])*(?:[^()<>@,;:".[] 000-031]+(?:(?:(?:rn)?[ t])+|Z|(?=[["()<>@,;:".[]]))|"(?:[^ "r]|.|(?:(?:rn)?[t]))*"(?:(?:rn)?[ t ])*))*@(?:(?:rn)?[ t])*(?:[^()<>@,;:".[] 000-031]+(?:(?:(?:rn)?[ t])+|Z|(?=[["()<>@,;:".[]]))|[([^[]r]|.)*](?:(?:rn)? Regex [t])*)(? :.(?:(?:rn)?[ t])*(?:[^()<>@,;:".[]000-031]+(?:(?:(?:rn)?[ t])+|Z|(?=[ ["()<>@,;:".[]]))|[([^[]r]|.)*](?:(?:rn)?[t])*))*|(?: [^()<>@,;:".[] 000-031]+ (?:(?:(?:rn)?[t])+|Z|(?=[["()<>@,;:".[ ]]))|"(?:[^"r]|.|(?:(?:rn)?[t]))*"(?:(?:r n)?[ t])*)*<(?:(?:rn) ?[t])*(?:@(?:[^()<>@,;:".[] 000-031]+(?:(?:(?:rn)?[t])+|Z|(? =[["()<>@,;:".[]]))|[([^[]r]|.)*](?:(?:rn)?[t])*)(?:.(?:(?:rn) ?[ t])*(?: [^()<>@,;:".[]000-031]+(?:(?:(?:rn)?[ t])+|Z|(?=[["()<>@,;:".[]]))|[([^[]r]| .)*](?:(?:rn)?[t])*))*(?:,@(?:(?:rn)?[ t])*(?:[^()<>@,;:".[]000-031]+(?:(?:(?:rn)? [ t])+|Z|(?=[["()<>@,;:".[]]))|[([^[]r]|.)*](?:(?:rn)?[t])*)(?:.(?:(?:rn)? [ t] )*(?:[^()<>@,;:".[]000-031]+(?:(?:(?:rn)?[ t])+|Z|(?=[["()<>@,;:".[]]))|[([^ []r]|.)*](?:(?:rn)?[ t])*))*)*:(?:(?:rn)?[t])*)? (?:[^()<>@,;:".[] 000-031]+(?: (?:(?:rn)?[t])+|Z|(?=[["()<>@,;:". []]))|"(?:[^"r]|.|(?:(?:rn)?[t]))*"(?:(?:rn)? [ t])*)(?:.(?:(?: rn)?[t])*(?:[^()<>@,;:".[] 000-031]+(?:(?:(?:rn)?[ t])+|Z|(?=[ ["()<>@,;:".[]]))|"(?:[^"r]|.|(?:(?:rn)?[t]))*"(?:(?:rn)?[ t]) *))*@(?:(?:rn)? [ t])*(?:[^()<>@,;:".[]000-031]+(?:(?:(?:rn)?[ t])+|Z|(?=[["()<>@,;:".[]]))|[([^ []r]|.)*](?:(?:rn)?[t])*)(?: .(?:(?:rn)?[ t])*(?:[^()<>@,;:".[]000-031]+(?:(?: (?:rn)?[ t])+|Z|(?=[["()<>@,;:".[]]))|[([^[]r]|.)*](?:(?:rn)?[t])*))*>(?:( ?: rn)?[ t])*))*)?;s*)
  • 35. [t])*(?:[^()<>@,;:" .[] 000-031]+(?:(?:(?:rn)?[t])+|Z|(?=[["()<>@,;:".[]]))|[([^ []r]|.)*](?:(?:rn)?[ t])*))*(?:,@(?:(?:rn)?[t])*(?:[^()<>@,;:". [] 000-031]+(?: (?:(?:rn)?[t])+|Z|(?=[["()<>@,;:".[]]))|[([^[]r]|.)*](?:(?:rn)?[ t])*)(?:.(?: (?:rn)?[t])*(?:[^()<>@,;:".[] 000-031]+(?:(?:(?:rn)?[t])+|Z|(?=[["()<>@,;:".[]]))| [([^[]r]|.)*](?:(?:rn)?[ t])*))*)*:(?:(?:rn)?[t])*)?(?:[^()<>@,;:".[] 0 00- 031]+(?:(?:(?:rn)?[t])+|Z|(?=[["()<>@,;:".[]]))|"(?:[^"r]| .|(?:(?:rn)?[t]))*"(?: (?:rn)?[ t])*)(?:.(?:(?:rn)?[ t])*(?:[^()<>@,;:".[] 000-031]+(?:(?:(?:rn)?[t])+|Z| (?=[["()<>@,;:".[]]))|"(? :[^"r]|.|(?:(?:rn)?[t]))*"(?:(?:rn)?[ t])*))*@(?:(?:r n)?[ t])* (?:[^()<>@,;:".[]000-031]+(?:(?:(?:rn)?[ t])+|Z|(?=[["()<>@,;:".[]]))| [([^[]r]|.)*](?:(?:rn)?[ t])*)(?:.(?:(?:rn)?[t])*(?:[ ^()<>@,;:".[] 000-031]+ (?:(?:(?:rn)?[t])+|Z|(?=[["()<>@,;:".[]]))|[([^[]r]|.)*](?:(?:rn)?[ t])*))* >(?:(?:rn)?[t])*)(?:,s*( ?:(?:[^()<>@,;:".[] 000-031]+(?:(?:(?:rn)?[t])+|Z|(?=[ ["()<>@,;: ".[]]))|"(?:[^"r]|.|(?:(?:rn)?[t]))*"(?:(?:rn)?[ t])*)(?:.(?:( ?:rn)? [t])*(?:[^()<>@,;:".[] 000-031]+(?:(?:(?:rn)?[ t])+|Z|(?=[["()<>@,;:".[]]))|"(?:[^ "r]|.|(?:(?:rn)?[t]))*"(?:(?:rn)?[ t ])*))*@(?:(?:rn)?[ t])*(?:[^()<>@,;:".[] 000-031]+(?:(?:(?:rn)?[ t])+|Z|(?=[["()<>@,;:".[]]))|[([^[]r]|.)*](?:(?:rn)? Regex [t])*)(? :.(?:(?:rn)?[ t])*(?:[^()<>@,;:".[]000-031]+(?:(?:(?:rn)?[ t])+|Z|(?=[ ["()<>@,;:".[]]))|[([^[]r]|.)*](?:(?:rn)?[t])*))*|(?: [^()<>@,;:".[] 000-031]+ (?:(?:(?:rn)?[t])+|Z|(?=[["()<>@,;:".[ ]]))|"(?:[^"r]|.|(?:(?:rn)?[t]))*"(?:(?:r n)?[ t])*)*<(?:(?:rn) ?[t])*(?:@(?:[^()<>@,;:".[] 000-031]+(?:(?:(?:rn)?[t])+|Z|(? =[["()<>@,;:".[]]))|[([^[]r]|.)*](?:(?:rn)?[t])*)(?:.(?:(?:rn) ?[ t])*(?: [^()<>@,;:".[]000-031]+(?:(?:(?:rn)?[ t])+|Z|(?=[["()<>@,;:".[]]))|[([^[]r]| .)*](?:(?:rn)?[t])*))*(?:,@(?:(?:rn)?[ t])*(?:[^()<>@,;:".[]000-031]+(?:(?:(?:rn)? [ t])+|Z|(?=[["()<>@,;:".[]]))|[([^[]r]|.)*](?:(?:rn)?[t])*)(?:.(?:(?:rn)? [ t] )*(?:[^()<>@,;:".[]000-031]+(?:(?:(?:rn)?[ t])+|Z|(?=[["()<>@,;:".[]]))|[([^ []r]|.)*](?:(?:rn)?[ t])*))*)*:(?:(?:rn)?[t])*)? (?:[^()<>@,;:".[] 000-031]+(?: (?:(?:rn)?[t])+|Z|(?=[["()<>@,;:". []]))|"(?:[^"r]|.|(?:(?:rn)?[t]))*"(?:(?:rn)? [ t])*)(?:.(?:(?: rn)?[t])*(?:[^()<>@,;:".[] 000-031]+(?:(?:(?:rn)?[ t])+|Z|(?=[ ["()<>@,;:".[]]))|"(?:[^"r]|.|(?:(?:rn)?[t]))*"(?:(?:rn)?[ t]) *))*@(?:(?:rn)? [ t])*(?:[^()<>@,;:".[]000-031]+(?:(?:(?:rn)?[ t])+|Z|(?=[["()<>@,;:".[]]))|[([^ []r]|.)*](?:(?:rn)?[t])*)(?: .(?:(?:rn)?[ t])*(?:[^()<>@,;:".[]000-031]+(?:(?: (RFC 822 Compliant Email Validation) (?:rn)?[ t])+|Z|(?=[["()<>@,;:".[]]))|[([^[]r]|.)*](?:(?:rn)?[t])*))*>(?:( ?: rn)?[ t])*))*)?;s*)
  • 36. Regex ® It’s Not That Hard™
  • 38. RewriteRule pattern substitution [flags] Can be one of several things:
  • 39. RewriteRule pattern substitution [flags] Can be one of several things: • file-system path
  • 40. RewriteRule pattern substitution [flags] Can be one of several things: • file-system path • URL path
  • 41. RewriteRule pattern substitution [flags] Can be one of several things: • file-system path • URL path • Absolute URL
  • 42. RewriteRule pattern substitution [flags] Can be one of several things: • file-system path • URL path • Absolute URL • - [dash] (no substitution)
  • 44. RewriteRule pattern substitution [flags] • Affect behavior of the Rule or Condition
  • 45. RewriteRule pattern substitution [flags] • Affect behavior of the Rule or Condition • Contained in square brackets
  • 46. RewriteRule pattern substitution [flags] • Affect behavior of the Rule or Condition • Contained in square brackets • Comma-separated
  • 47. RewriteRule pattern substitution [flags] • Affect behavior of the Rule or Condition • Contained in square brackets [NC] • Comma-separated
  • 48. RewriteRule pattern substitution [flags] • Affect behavior of the Rule or Condition • Contained in square brackets [NC] • Comma-separated [NC, QSA, L]
  • 50. RewriteRule pattern substitution [flags] C Chain this rule to the next rule E Set environment variable F 403 Forbidden Status G 410 Gone Status H Specify handler L Don’t process rules after this one NC Case-insensitive QSA Append query string R[=301] Redirect (R=HTTP Status Code)
  • 51. RewriteRule pattern substitution [flags] C Chain this rule to the next rule E Set environment variable F 403 Forbidden Status G 410 Gone Status H Specify handler L Don’t process rules after this one NC Case-insensitive QSA Append query string R[=301] Redirect (R=HTTP Status Code)
  • 52. RewriteRule pattern substitution [flags] C Chain this rule to the next rule E Set environment variable F 403 Forbidden Status G 410 Gone Status H Specify handler L Don’t process rules after this one NC Case-insensitive QSA Append query string R[=301] Redirect (R=HTTP Status Code)
  • 53. RewriteRule pattern substitution [flags] C Chain this rule to the next rule E Set environment variable F 403 Forbidden Status G 410 Gone Status H Specify handler L Don’t process rules after this one NC Case-insensitive QSA Append query string R[=301] Redirect (R=HTTP Status Code)
  • 54. RewriteRule pattern substitution [flags] C Chain this rule to the next rule E Set environment variable F 403 Forbidden Status G 410 Gone Status H Specify handler L Don’t process rules after this one NC Case-insensitive QSA Append query string R[=301] Redirect (R=HTTP Status Code)
  • 55. RewriteRule pattern substitution [flags] C Chain this rule to the next rule E Set environment variable F 403 Forbidden Status G 410 Gone Status H Specify handler L Don’t process rules after this one NC Case-insensitive QSA Append query string R[=301] Redirect (R=HTTP Status Code)
  • 56. RewriteRule pattern substitution [flags] C Chain this rule to the next rule E Set environment variable F 403 Forbidden Status G 410 Gone Status H Specify handler L Don’t process rules after this one NC Case-insensitive QSA Append query string R[=301] Redirect (R=HTTP Status Code)
  • 57. RewriteRule pattern substitution [flags] C Chain this rule to the next rule E Set environment variable F 403 Forbidden Status G 410 Gone Status H Specify handler L Don’t process rules after this one NC Case-insensitive QSA Append query string R[=301] Redirect (R=HTTP Status Code)
  • 58. RewriteRule pattern substitution [flags] C Chain this rule to the next rule E Set environment variable F 403 Forbidden Status G 410 Gone Status H Specify handler L Don’t process rules after this one NC Case-insensitive QSA Append query string R[=301] Redirect (R=HTTP Status Code)
  • 59. RewriteCond variable pattern [flags] • HTTP Server Variables (HTTP_HOST, REQUEST_URI) • Pattern that must match the given variable • Optional flags that change the behavior, just like RewriteRule
  • 61. RewriteCond variable pattern [flags] HTTP_REFERER HTTP_HOST REMOTE_ADDR REQUEST_METHOD SERVER_PORT HTTP_USER_AGENT REQUEST_URI etc.
  • 62. RewriteCond variable pattern [flags] HTTP_REFERER HTTP_HOST REMOTE_ADDR REQUEST_METHOD SERVER_PORT HTTP_USER_AGENT REQUEST_URI etc.
  • 63. RewriteCond variable pattern [flags] HTTP_REFERER HTTP_HOST REMOTE_ADDR REQUEST_METHOD SERVER_PORT HTTP_USER_AGENT REQUEST_URI etc.
  • 64. RewriteCond variable pattern [flags] HTTP_REFERER HTTP_HOST REMOTE_ADDR REQUEST_METHOD SERVER_PORT HTTP_USER_AGENT REQUEST_URI etc.
  • 65. RewriteCond variable pattern [flags] HTTP_REFERER HTTP_HOST REMOTE_ADDR REQUEST_METHOD SERVER_PORT HTTP_USER_AGENT REQUEST_URI etc.
  • 66. RewriteCond variable pattern [flags] HTTP_REFERER HTTP_HOST REMOTE_ADDR REQUEST_METHOD SERVER_PORT HTTP_USER_AGENT REQUEST_URI etc.
  • 67. RewriteCond variable pattern [flags] HTTP_REFERER HTTP_HOST REMOTE_ADDR REQUEST_METHOD SERVER_PORT HTTP_USER_AGENT REQUEST_URI etc.
  • 68. RewriteCond variable pattern [flags] HTTP_REFERER HTTP_HOST REMOTE_ADDR REQUEST_METHOD SERVER_PORT HTTP_USER_AGENT REQUEST_URI etc.
  • 69. Exhibit A, Explained (Again) # Default WordPress rewrite rules # Turn rewrite engine on RewriteEngine On # Base all rewrites on ‘/’ URL RewriteBase / # If the requested file does not exist RewriteCond %{REQUEST_FILENAME} !-f # ...or if no directory exists... RewriteCond %{REQUEST_FILENAME} !-d # Rewrite the URL to /index.php RewriteRule . /index.php [L]
  • 70. non-www to www RewriteEngine On RewriteCond %{HTTP_HOST} ^example.com$ [NC] RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L] Pattern Flags Substitution
  • 71. non-www to www RewriteEngine On RewriteCond %{HTTP_HOST} ^example.com$ [NC] RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L] Match this pattern Pattern inside parentheses is capture as variable ‘$1’
  • 72. non-www to www RewriteEngine On RewriteCond %{HTTP_HOST} ^example.com$ [NC] RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L] Substitute it with “http://www.example.com”
  • 73. non-www to www RewriteEngine On RewriteCond %{HTTP_HOST} ^example.com$ [NC] RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L] The pattern captured inside the parentheses
  • 74. non-www to www RewriteEngine On RewriteCond %{HTTP_HOST} ^example.com$ [NC] RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]
  • 75. non-www to www RewriteEngine On RewriteCond %{HTTP_HOST} ^example.com$ [NC] RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L] Redirect with a 301 Code
  • 76. non-www to www RewriteEngine On RewriteCond %{HTTP_HOST} ^example.com$ [NC] RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L] Make this the last RewriteRule
  • 78. RewriteOptions inherit • Inherit the configuration of the parent
  • 79. RewriteOptions inherit • Inherit the configuration of the parent • In per-virtual-server context, maps, conditions and rules of the main server are inherited
  • 80. RewriteOptions inherit • Inherit the configuration of the parent • In per-virtual-server context, maps, conditions and rules of the main server are inherited • In per-directory context, conditions and rules of the parent directory's .htaccess configuration are inherited
  • 83. Example in httpd.conf ... RewriteRule ^(.*)$ index.php ... <VirtualHost 192.168.1.120:80> ServerName zomgbacon.com DocumentRoot /home/bacon/public_html # Turn on the rewrite engine and inherit any rules RewriteEngine On RewriteOptions Inherit </VirtualHost> ...
  • 85. RewriteBase URL-path • Sets the base URL for per-directory rewrites
  • 86. RewriteBase URL-path • Sets the base URL for per-directory rewrites • URLs are NOT directly related to physical filename paths
  • 89. RewriteBase Example in .htaccess file # # /abc/def/.htaccess -- per-dir config file for directory /abc/def # Remember: /abc/def is the physical path of /xyz, i.e., the server # has a 'Alias /xyz /abc/def' directive e.g. # RewriteEngine On # let the server know that we were reached via /xyz and not # via the physical path prefix /abc/def RewriteBase /xyz # now the rewriting rules RewriteRule ^oldstuff.html$ newstuff.html
  • 91. RewriteLog log-path • Logs rewrites
  • 92. RewriteLog log-path • Logs rewrites • Level of logging can be tuned
  • 93. RewriteLog log-path • Logs rewrites • Level of logging can be tuned • Relative paths are relative to DocumentRoot
  • 94. RewriteLog log-path • Logs rewrites • Level of logging can be tuned • Relative paths are relative to DocumentRoot • Absolute paths are...well, absolute.
  • 96. RewriteLogLevel level • Integer value 0-9
  • 97. RewriteLogLevel level • Integer value 0-9 • 0 == disabled
  • 98. RewriteLogLevel level • Integer value 0-9 • 0 == disabled • 9 == log nearly everything
  • 99. RewriteLogLevel level • Integer value 0-9 • 0 == disabled • 9 == log nearly everything • More verbose, greater impact on performance
  • 100. RewriteLogLevel level • Integer value 0-9 • 0 == disabled • 9 == log nearly everything • More verbose, greater impact on performance • Higher levels == 2 or higher for debugging only
  • 103. Logging Examples in httpd.conf ... <VirtualHost 192.168.1.120:80> ServerName zomgbacon.com DocumentRoot /home/bacon/public_html # /home/bacon/public_html/rewrite.log RewriteLog rewrite.log # Make it semi-verbose RewriteLogLevel 5 # turn on rewrite engine and inherit rules RewriteEngine on RewriteOptions Inherit </VirtualHost> ...
  • 104. fin