简体   繁体   English

如何为本地主机配置htaccess?

[英]How to configure htaccess for localhost?

I am working on a project maintenance where, I need to configure htaceess file to run project on localhost, because I have created a virtual host to run the project. 我正在项目维护中,我需要配置htaceess文件以在localhost上运行项目,因为我已经创建了一个虚拟主机来运行该项目。

I have following code - 我有以下代码-

RewriteEngine On
Options +FollowSymlinks
RewriteBase /

RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

RewriteCond %{HTTPS} on
RewriteRule ^(?!(text1|text2|text3)\.html|common-secure\.php|images\/|css-secure\/|javascript\/).* http://%{HTTP_HOST}%{REQUEST_URI} [R=301]

RewriteRule ^index.(.*)\.html$ index.php?langurl=$1&%{QUERY_STRING}
RewriteRule ^index.html$ index.php?%{QUERY_STRING}
RewriteRule ^city/(.*)\.(.*)\.(.*)\.html$ city.php?cityurl=$1&langurl=$2&page=$3&%{QUERY_STRING}


#Other rules

I replaced last 4th and 5th line above by following - 我将以下的第四行和第五行替换为:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

But, still not able to load the js plugins. 但是,仍然无法加载js插件。 Also, not getting query string parameters (like 'langurl') into $_GET. 另外,不要将查询字符串参数(如“ langurl”)放入$ _GET中。

What am I missing/went wrong here? 我在这里想念/弄错了什么?

Thanks. 谢谢。

您想在RewriteBase添加网站目录

RewriteBase /projectfolder/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM