Answer the question
In order to leave comments, you need to log in
How to configure htaccess on locales?
I can't set up rewrite rules on the local server. It works on hosting, but not on localhost. Tell me how you need to change htaccess for proper work?
On the hosting, the working htaccess is:
RewriteEngine on
RewriteRule ^faq/([a-z\/]+)$ faq.php?z=$1 [QSA,L]
RewriteRule ^faq#([a-z\/]+)$ faq.php#$1 [QSA,L]
RewriteRule ^article/([\d+]+)$ article.php?count=$1 [QSA,L]
RewriteRule ^article/z([\d+]+)$ article.php?cur_page=$1 [QSA,L]
RewriteRule ^article/?comm=([\d+]+)$ article.php?comm=$1 [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php [QSA,L]
Answer the question
In order to leave comments, you need to log in
1. make sure you have mod_rewrite installed and activated.
2. you have apache installed and not nginx+fpm
3. don't forget to escape special characters, they don't work everywhere without escapes faq.php?z=$1 --> faq.php\?z\=$1
4. if you have it in .htacces <IfModule mod_php7.c>
make sure you have it 7
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question