Most people seem to be asking about converting .htaccess into vhost.conf. I need things the other way around. I have an existing vhost.conf file which looks like this....
ServerAlias base1.mydomain.com
ServerAlias base2.mydomain.com
ServerAlias base3.mydomain.com
ServerAlias www.mysite1.co.uk
ServerAlias www.mysite2.co.uk
RewriteEngine on
RewriteMap lowercase int:tolower
RewriteCond %{REQUEST_URI} !^/images/
RewriteCond %{REQUEST_URI} !^/code/
RewriteCond %{REQUEST_URI} !^/php/
RewriteCond %{REQUEST_URI} !^/php-bin/
RewriteCond %{REQUEST_URI} !^/syles/
RewriteCond %{REQUEST_URI} !^/js/
RewriteCond %{REQUEST_URI} !^/jquery/
RewriteRule ^/(.*)$ /var/www/vhosts/mydomain.com/subdomains/${lowercase:%{SERVER_NAME}}/htdocs/$1
Alias /scripts/ "/var/www/vhosts/mydomain.com/subdomains/ysite/V4_0_1/scripts/"
Alias /php/ "/var/www/vhosts/mydomain.com/subdomains/ysite/V4_0_1/php-bin/"
<Files ~ (\.phtml)>
SetHandler fcgid-script
FCGIWrapper /var/www/cgi-bin/cgi_wrapper/cgi_wrapper .phtml
Options +ExecCGI
allow from all
</Files>
<Files ~ (\.php)>
SetHandler fcgid-script
FCGIWrapper /var/www/cgi-bin/cgi_wrapper/cgi_wrapper .php
Options +ExecCGI
allow from all
</Files>
<Files ~ (\.php4)>
SetHandler fcgid-script
FCGIWrapper /var/www/cgi-bin/cgi_wrapper/cgi_wrapper .php4
Options +ExecCGI
allow from all
</Files>
Alias /php-bin/ "/var/www/vhosts/mydomain.com/subdomains/ysite/V4_5/php-bin/"
Alias /js/ "/var/www/vhosts/mydomain.com/subdomains/ysite/V4_5/js/"
Alias /css/ "/var/www/vhosts/mydomain.com/subdomains/ysite/V4_5/styles/"
Alias /jquery/ "/var/www/vhosts/mydomain.com/subdomains/ysite/V4_5/jquery/"
I am trying to convert this into a .htaccess files. Starting from the top, what is the equivalent .htaccess command to serveralias?
Not everything from vhost.conf
can be copied over to .htaccess since all directives aren't allowed in .htaccess
.
You can place this code in your DOCUMENT_ROOT/.htaccess
file:
RewriteEngine on
RewriteCond ${HOST_NAME} [A-Z]
RewriteCond %{REQUEST_URI} !^/(images|code|php|php-bin|styles|js|jquery)/
RewriteRule ^(.*)$ http://${lowercase:%{HOST_NAME}}/$1 [L,R]
<Files ~ (\.phtml)>
SetHandler fcgid-script
FCGIWrapper /var/www/cgi-bin/cgi_wrapper/cgi_wrapper .phtml
Options +ExecCGI
allow from all
</Files>
<Files ~ (\.php)>
SetHandler fcgid-script
FCGIWrapper /var/www/cgi-bin/cgi_wrapper/cgi_wrapper .php
Options +ExecCGI
allow from all
</Files>
<Files ~ (\.php4)>
SetHandler fcgid-script
FCGIWrapper /var/www/cgi-bin/cgi_wrapper/cgi_wrapper .php4
Options +ExecCGI
allow from all
</Files>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.