简体   繁体   中英

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.

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. Also, not getting query string parameters (like 'langurl') into $_GET.

What am I missing/went wrong here?

Thanks.

您想在RewriteBase添加网站目录

RewriteBase /projectfolder/

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.

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