Oz Web Services
  • Home
  • WP
  • PHP
  • JS
  • CSS
  • SCSS
  • HTML
  • XML
  • JSON
  • SQL
  • .htaccess
  • Apache
  • Nginx
  • INI
  • HTTP
  • Diff
Search shortcode

Virtual Host Bits

# For localhost on XAMPP, and others
# file: httpd-vhosts.conf
# restart apache after making changes

#-------------------------------------------------------    DOMAIN
<VirtualHost *:80>
    ServerName DOMAIN.dev
    ServerAlias www.DOMAIN.dev
    DocumentRoot "/path/to/document/root/DOMAIN/"
    <Directory "/path/to/document/root/DOMAIN/">
        AllowOverride All
        Order Allow,Deny
        Allow from all
        Require all granted
    </Directory>
</VirtualHost>
<VirtualHost *:443>
    ServerName DOMAIN.dev
    ServerAlias www.DOMAIN.dev
    DocumentRoot "/path/to/document/root/DOMAIN/"
    <Directory "/path/to/document/root/DOMAIN/">
        AllowOverride All
        Order Allow,Deny
        Allow from all
        Require all granted
    </Directory>
    SSLEngine on
    SSLCertificateFile "/path/to/ssl/crt/DOMAIN.crt"
    SSLCertificateKeyFile "/path/to/ssl/key/DOMAIN.key"
</VirtualHost>

Example: Apache

# rewrite`s rules for wordpress pretty url
LoadModule rewrite_module  modules/mod_rewrite.so
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [NC,L]

ExpiresActive On
ExpiresByType application/x-javascript  "access plus 1 days"

Order Deny,Allow
Allow from All

<Location /maps/>
	RewriteMap map txt:map.txt
	RewriteMap lower int:tolower
	RewriteCond %{REQUEST_URI} ^/([^/.]+)\.html$ [NC]
	RewriteCond ${map:${lower:%1}|NOT_FOUND} !NOT_FOUND
	RewriteRule .? /index.php?q=${map:${lower:%1}} [NC,L]
</Location>
Oz Web Services
Copyright © 2015-2023 All Rights Reserved