It looks like a very simple question but without a simple answer : how do I enable mod_rewrite and correct .htaccess file handling for the default vhost ?
I want to host a wordpress site directly on www.domain.tld and domain.tld. after migration I see that all the links to pages are 404.
As far as I can see with php_info(), mod_rewrite is not enabled but I don’t really understand where to enable it.
Create the file to be read/add to httpd.conf
VHOST_DIRECTORY_NAME is the name given to your vhost
cat > /etc/httpd/conf.d/z_WordPress.conf <<'EOT'
# **************************************
# To enable Apache to read the .htaccess in WordPress
<Directory "var/lib/nethserver/vhost/VHOST_DIRECTORY_NAME">
Options Indexes FollowSymLinks
#
AllowOverride All
#
Require all granted
</Directory>
EOT
Restart Apache
systemctl restart httpd
Create .htacces in the root of your vhost (VHOST_DIRECTORY_NAME)
# **************************************
# Pour les permaliens
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /affaires/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /affaires/index.php [L]
</IfModule>
# **************************************
# DIRECTIVES POUR APACHE
#
# Permet au serveur de suivre les liens symboliques dans les répertoires concernés.
Options +FollowSymLinks
# Empêche d'afficher le contenu des répertoires s'ils ne contiennent aucun DirectoryIndex
# c'est-à-dire index.html, index.php etc...
Options -Indexes
If you use WordFence then after installing it:
# **************************************
# Wordfence WAF
<IfModule mod_php5.c>
php_value auto_prepend_file
'/var/lib/nethserver/vhostl/VHOST_DIRECTORY_NAME/wordfence-waf.php'
</IfModule>
<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
There is an error in it:
When you specify a file to be included in the backup data, there is no “/” at the end.
The “/” is for specifying a directory to be included in the backup data.
If there is one “/” for a file, it will be included in /etc/backup-data.d/custom.include but the backup will not backup it because it will see that it is a file and not a directory.
Especially for: /etc/profile.d/activer-php72.sh which is a file, not a directory.