Sujit Singh
Sujit Singh

Reputation: 921

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.

Upvotes: 1

Views: 4879

Answers (1)

Sumit Bijvani
Sumit Bijvani

Reputation: 8179

You missing to add directory of your website in RewriteBase

RewriteBase /projectfolder/

Upvotes: 1

Related Questions