我想在我的域名前面添加“www”,我已经完成但不确定它是否已正确添加,因为我从开源附带的原始.htaccess
文件中删除了一些代码脚本。
原始.htaccess
文件:
# secure htaccess file
<Files .htaccess>
order allow,deny
deny from all
</Files>
# disable directory browsing
Options All -Indexes
# disabel access to logs/template files
<Files ~ "\.(log|tpl)$">
order allow,deny
deny from all
</files>
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/uploaded [NC]
RewriteCond %{REQUEST_URI} !\.(jpe?g|png|gif)$ [NC]
RewriteRule .* - [F,L]
当前.htaccess
文件:
# secures htaccess file
<Files .htaccess>
order allow,deny
deny from all
</Files>
# disable directory browsing
Options All -Indexes
# disable access to logs/template files
<Files ~ "\.(log|tpl)$">
order allow,deny
deny from all
</files>
# Force www:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^websitename.com$ [NC]
RewriteRule ^(.*)$ http://www.websitename.com/$1 [L,R=301,NC]
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/uploaded [NC]
RewriteCond %{REQUEST_URI} !\.(jpe?g|png|gif)$ [NC]
RewriteRule .* - [F,L]