<rdf:RDF
    xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'
    xmlns:s='http://snipsnap.org/rdf/snip-schema#'
    xml:base='http://bliki.rimuhosting.com/rdf'>
    <s:Snip rdf:about='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/webserver/apache/mod_rewrite'
         s:cUser='kron'
         s:oUser=''
         s:mUser='retep'>
        <s:name>knowledgebase/linux/webserver/apache/mod_rewrite</s:name>
        <s:content>1 Redirect all URLs to HTTPS with mod_rewrite&#xD;&#xA;&#xD;&#xA;{code:none}&#xD;&#xA;RewriteEngine on&#xD;&#xA;RewriteRule   ^.*$   https:\//%{SERVER_NAME} [R]&#xD;&#xA;{code}&#xD;&#xA;&#xD;&#xA;(This can go inside a VirtualHost if you just want the rule to apply to that virtual host.)&#xD;&#xA;&#xD;&#xA;1 Redirecting Requests for Multiple Domains To Just One Domain&#xD;&#xA;&#xD;&#xA;{code}&#xD;&#xA;RewriteEngine on&#xD;&#xA;RewriteRule   ^.*$   http:\//someotherdomain.com [R]&#xD;&#xA;{code}&#xD;&#xA;&#xD;&#xA;__Note__: Remove any &apos;&gt;&gt;&apos; characters that the html on this page adds to that url if you copy/paste it.&#xD;&#xA;&#xD;&#xA;Or, say you wanted certain urls to redirect from the regular domain to an https/ssl secured domain you could do something like:&#xD;&#xA;&#xD;&#xA;{code}&#xD;&#xA;RewriteEngine on&#xD;&#xA;RewriteRule   ^/store/(.*)$   https:\//someotherdomain.com/store/$1 [R]&#xD;&#xA;{code}&#xD;&#xA;&#xD;&#xA;1 Redirecting all requests for .html files to a PHP script.&#xD;&#xA;&#xD;&#xA;This comes in handy if you to convert an existing set of static HTML files over to just one PHP script, without breaking all your existing URLs.&#xD;&#xA;&#xD;&#xA;eg: http://your.com/someold.html would still work, but content would be generated by the &apos;some.php&apos; script.&#xD;&#xA;&#xD;&#xA;{code:none}&#xD;&#xA;&lt;Location /&gt;&#xD;&#xA;  RewriteEngine on&#xD;&#xA;  RewriteBase /&#xD;&#xA;  RewriteRule .html some.php [T=application/x-httpd-php]&#xD;&#xA;&lt;/Location&gt;&#xD;&#xA;{code}&#xD;&#xA;&#xD;&#xA;1 Blocking Image Hotlinking&#xD;&#xA;&#xD;&#xA;Sometimes other websites will reference images located on your server.  This consumes your bandwidth and some consider it stealing and it is impolite in the very least.  To prevent this from happening, you can use a simple mod_rewrite rule (This can go inside a virtual host definition if you want it to just apply to that virtual host):&#xD;&#xA;&#xD;&#xA;{code}&#xD;&#xA;RewriteEngine on&#xD;&#xA;RewriteCond %{HTTP_REFERER} !=&quot;&quot;&#xD;&#xA;RewriteCond %{HTTP_REFERER} &quot;!^http:/\/yourdomain.com/.*$&quot; [NC]&#xD;&#xA;#the following will block requests for 3 image types, but you can extend this to any&#xD;&#xA;#resource type&#xD;&#xA;RewriteCond %{REQUEST_URI}  &quot;\.(jpg|gif|png)$&quot;&#xD;&#xA;RewriteRule .* - [F]&#xD;&#xA;{code}</s:content>
        <s:mTime>2007-05-07 00:45:45.0</s:mTime>
        <s:cTime>2005-08-26 00:18:14.0</s:cTime>
        <s:comments
             rdf:type='http://www.w3.org/1999/02/22-rdf-syntax-ns#Bag'/>
        <s:snipLinks>
            <rdf:Bag>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/webserver/apache'/>
                <rdf:li rdf:resource='#snipsnap-search'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux'/>
                <rdf:li rdf:resource='#knowledgebase'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/webserver'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/misc/ajax autocomplete'/>
                <rdf:li rdf:resource='#snipsnap-index'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/miscapplications/ruby on rails'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/miscapplications/phpmyadmin'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/webserver/apache/'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/mail/postfix with amavis and mysql'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/mail/mass emailing best practices'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/java/working with different character encodings'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/webserver/plesk notes'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/mail/postfixadmin on debian sarge'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/mail/sendmail notes'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/distros/RHEL 4'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/filtered webmin'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/miscapplications/rpm based php5.1 install'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/rimuhosting/moving servers'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/webserver/apache/redirects'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/webserver/'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/webserver/apache/installing and using mod_fastcgi'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/rimuhosting/monthly CC billing not working'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/mail/moving imap folders between hosts'/>
                <rdf:li rdf:resource='#kron'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/mail/postfix notes'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/rimuhosting/rimuhosting ssh access'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/java/liferay install on tomcat 5.5'/>
            </rdf:Bag>
        </s:snipLinks>
        <s:attachments
             rdf:type='http://www.w3.org/1999/02/22-rdf-syntax-ns#Bag'/>
    </s:Snip>
</rdf:RDF>
