如何创建.htaccess文件?是否需要在创建.htaccess文件后重新启动服务器?
RewriteEngine On
RewriteCompatibility2 On
RepeatLimit 200
RewriteBase
# unsupported directive: [ISAPI_Rewrite]
RewriteCond %{HTTP:Host} ^xxx\.com$
RewriteRule (.*) http\://www.xxxx.com$1 [NC,R=301,U]
RewriteRule ^/main.html$ http\://www.xxx.com/index.cfm [NC,R=301,U]
ErrorDocument 404 /Errors.htm
提前致谢。
答案 0 :(得分:3)
如何创建.htaccess文件?
打开文本编辑器。开始输入。
您可能需要与编辑器对抗才能保存“只有扩展名”的文件。您可能必须对抗上传器软件(如果您在与服务器不同的系统上创建文件)以使其看到该文件。
创建.htaccess文件后需要重启服务器
没有。 .htaccess的大部分意思是它是即时处理的。
答案 1 :(得分:1)
不,只有在更改httpd.conf文件或vhosts文件时才需要重新启动。 .htaccess
个文件不需要重启。
答案 2 :(得分:1)
.htaccess
是常规文本文件。而且您不需要重新启动服务器。它将在下次请求时处理
答案 3 :(得分:0)
创建或更改.htaccess文件后,无需重新启动服务器。将.htaccess文件放在需要应用规则的文件夹中。您可以为服务器上的不同文件夹添加不同的.htaccess文件。