Problem with .htacces

Hello everyone! I tried to sort information in my htacces file. But any changes give me nagative results. I have an error after changes. Maybe it’s problem with my wordpress? Please check website Before i worked with joomla without any problems with htacces. Please help!

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{ENV:HTTPS} !=on
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R,L]
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

# END WordPress
# Wordfence WAF
<IfModule mod_php5.c>
	php_value auto_prepend_file '/home/'
<Files ".user.ini">
<IfModule mod_authz_core.c>
	Require all denied
<IfModule !mod_authz_core.c>
	Order deny,allow
	Deny from all
# END Wordfence WAF
#Типа сжатие
ExpiresActive On
ExpiresDefault "access plus 3600 seconds"
ExpiresByType image/x-icon "access plus 2592000 seconds"
ExpiresByType image/jpeg "access plus 2592000 seconds"
ExpiresByType image/jpg "access plus 2592000 seconds"
ExpiresByType image/ico "access plus 2592000 seconds"
ExpiresByType image/png "access plus 2592000 seconds"
ExpiresByType image/gif "access plus 2592000 seconds"
ExpiresByType application/x-shockwave-flash "access plus 2592000 seconds"
ExpiresByType text/css "access plus 604800 seconds"
ExpiresByType text/javascript "access plus 216000 seconds"
ExpiresByType application/javascript "access plus 604800 seconds"
ExpiresByType application/x-javascript "access plus 604800 seconds"
ExpiresByType text/html "access plus 3600 seconds"
ExpiresByType application/xhtml+xml "access plus 3600 seconds"
Header set Cache-Control "max-age=2592000, public"
Header set Cache-Control "max-age=604800, public"
Header set Cache-Control "max-age=216000, private"
Header set Cache-Control "max-age=3600, private, must-revalidate"
# Выключаем ETags
FileETag None
Header set Cache-Control "max-age=290304000, public
Header unset Last-Modified
SetOutputFilter DEFLATE
#Конец сжатия

If you change them back, will the file work?

No! Thats my problem

What are the “negative results”? Your site is accessible. What is the problem you’re experiencing?

I note that you have the if statement
<IfModule mod_rewrite.c>
twice but with only one

I’ll try to do something with it. Thanks!

My understanding (from years of reading @dklynn’s posts) is that you should only use the <IfModule ...> wrapper once, when testing. Once you know that the module is enabled, you should remove that wrapper. Otherwise, you are wasting resources by continually asking Apache to test for something you already know exists.


Yes, Apache reads the htaccess file for every request so even though the waste might be relatively insignificant it is waste.

I think the reason some leave it in is because they see it in distributed apps like WordPress. Because WordPress doesn’t know beforehand what a users setup will be the “if module” is needed. But for personal use it should be known what modules are enabled and there should be no need to do the checking.


Both TB and Mitt are correct (about the waste of time). Ditto the unclosed < IfModule > directive.

IMHO, the worst thing I see is that .htaccess is used without the last S by the Op. Since Apache is rather particular about naming important files like this, that “typo” SHOULD cause .htacces to be ignored ( “negative results”).




Oh…Thank you guys! I will try to do it better.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.