/    Sign up×
Community /Pin to ProfileBookmark

Is this htaccess code correct

WORDPRESS : 5.4.2 / MY PHP : 7.4.8 / SERVER : APACHE / MYSQL : 5. 7. 28 / HOSTING : 1&1 IONOS (on sharing, mutual hosting) / PROTOCOLE SSL : ENABLE

Hi everyone!
I try to build my website for make social actions,I’m beginner in web development, i would like a people check my .htacces

My domain look like https://xxxxxx-xxxxx.fr i have redirection for people come in https://www.xxxxxx-xxxxx.fr (I want keep this configuration www.xxxxxxx-xxxxx.fr for endpoint)

I have replace my url website by : https://www.xxxxxx-xxxxxxx.fr/ for privacy If you need my url website I can send it to you in a private message.

MY HTACCES CODE :

# BEGIN WordPress


# Les directives (lignes) entre ‘BEGIN WordPress’ et ‘END WordPress’ sont


# généré dynamiquement, et ne doivent uniquement être modifiées via les filtres WordPress.


# Toute modification des directives entre ces marqueurs sera outrepassée.

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ – [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress
## EXPIRES HEADER CACHING ##
ExpiresActive On
ExpiresByType image/jpg “access 1 year”
ExpiresByType image/jpeg “access 1 year”
ExpiresByType image/gif “access 1 year”
ExpiresByType image/png “access 1 year”
ExpiresByType image/svg “access 1 year”
ExpiresByType text/css “access 1 month”
ExpiresByType application/pdf “access 1 month”
ExpiresByType application/javascript “access 1 month”
ExpiresByType application/x-javascript “access 1 month”
ExpiresByType application/x-shockwave-flash “access 1 month”
ExpiresByType image/x-icon “access 1 year”
ExpiresDefault “access 2 days”
## EXPIRES HEADER CACHING ##

# Make PHP code look like unknown types
AddType application/x-httpd-php .bop .foo .133t
<IfModule mod_rewrite.c>
RewriteEngine on
# HSTS preload
RewriteCond %{HTTP_HOST} !^www.[^.]+.[^.]+$
# Then redirect http to https (if necessary)
RewriteCond %{HTTPS} on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [NE,L,R=301]
</IfModule>

# BEGIN WP-Optimize Gzip compression
<IfModule mod_filter.c>
<IfModule mod_deflate.c>
# Compress HTML, CSS, JavaScript, Text, XML and fonts
AddType application/vnd.ms-fontobject .eot
AddType font/ttf .ttf
AddType font/otf .otf
AddType font/x-woff .woff
AddType image/svg+xml .svg
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
AddOutputFilterByType DEFLATE application/x-font
AddOutputFilterByType DEFLATE application/x-font-opentype
AddOutputFilterByType DEFLATE application/x-font-otf
AddOutputFilterByType DEFLATE application/x-font-truetype
AddOutputFilterByType DEFLATE application/x-font-ttf
AddOutputFilterByType DEFLATE application/x-font-woff
AddOutputFilterByType DEFLATE application/x-javascript
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE font/opentype
AddOutputFilterByType DEFLATE font/otf
AddOutputFilterByType DEFLATE font/ttf
AddOutputFilterByType DEFLATE font/woff
AddOutputFilterByType DEFLATE image/svg+xml
AddOutputFilterByType DEFLATE image/x-icon
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/javascript
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/xml
# Remove browser bugs (only needed for really old browsers)
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4.0[678] no-gzip
BrowserMatch bMSIE !no-gzip !gzip-only-text/html
Header append Vary User-Agent
</IfModule>
</IfModule>
# END WP-Optimize Gzip compression

# BEGIN WP-Optimize Browser Cache
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType text/css “access 28 days”
ExpiresByType text/html “access 28 days”
ExpiresByType image/gif “access 28 days”
ExpiresByType image/png “access 28 days”
ExpiresByType image/jpg “access 28 days”
ExpiresByType image/jpeg “access 28 days”
ExpiresByType image/webp “access 28 days”
ExpiresByType image/x-icon “access 28 days”
ExpiresByType application/pdf “access 28 days”
ExpiresByType application/javascript “access 28 days”
ExpiresByType text/x-javascript “access 28 days”
ExpiresByType application/x-shockwave-flash “access 28 days”
ExpiresDefault “access 28 days”
</IfModule>

<IfModule mod_headers.c>
<filesMatch “.(ico|jpe?g|png|gif|webp|swf)$”>
Header set Cache-Control “public”
</filesMatch>

<filesMatch “.(css)$”>
Header set Cache-Control “public”
</filesMatch>

<filesMatch “.(js)$”>
Header set Cache-Control “private”
</filesMatch>

<filesMatch “.(x?html?|php)$”>
Header set Cache-Control “private, must-revalidate”
</filesMatch>
</IfModule>

#Disable ETag
FileETag None
# END WP-Optimize Browser

# Wordfence WAF
<Files “.user.ini”>
<IfModule mod_authz_core.c>
Require all denied
</IfModule>

<IfModule !mod_authz_core.c>
Order deny,allow
Deny from all
</IfModule>
</Files>
# END Wordfence WAF

Thank so much for your help
Wishing you a good day.

to post a comment
CSSJavaScript

0Be the first to comment 😎

×

Success!

Help @Rememberthisusername spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 4.25,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...