Skip to content

Instantly share code, notes, and snippets.

@methbkts
Created September 2, 2019 13:03
Show Gist options
  • Select an option

  • Save methbkts/1c334329bd0a2ab11f66bf49caa8117a to your computer and use it in GitHub Desktop.

Select an option

Save methbkts/1c334329bd0a2ab11f66bf49caa8117a to your computer and use it in GitHub Desktop.
sudo a2enmod rewrite
sudo vim /etc/apache2/sites-available/000-default.conf
<Directory /var/www/html>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
sudo vim /var/www/html/.htaccess
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php [L]
sudo systemctl restart apache2
# 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]
</IfModule>
# END WordPress
sudo systemctl restart apache2
sudo a2enmod rewrite
sudo vim /etc/apache2/sites-available/000-default.conf
sudo systemctl restart apache2
<Directory /var/www/html>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>
Pour rediriger tout vers l'accueil, par exemple en cas de framework fait maison, avec un "public/index.php" :
DocumentRoot /var/www/html/public
<Directory /var/www/html/>
Options FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from all
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* / [R=301,L]
</Directory>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment