Dino Geek, try to help you

How to enable support for SEO friendly URLs in Apache?


You can enable support for SEO friendly URLs in Apache by using a module called mod\_rewrite. Here’s how to do it:

1. Enable mod\_rewrite

First, you need to enable mod\_rewrite module in Apache. This can be done by using the `a2enmod` command in your terminal: \`\`\` sudo a2enmod rewrite \`\`\` After executing this command, you need to restart the Apache server to apply changes: \`\`\` sudo service apache2 restart \`\`\`

1. AllowOverride directive

Next, you need to allow the use of `.htaccess` files within your website’s directory. This is done by changing the `AllowOverride` directive from ‘None’ to ‘All’. Open the default Apache configuration file: \`\`\` sudo nano /etc/apache2/sites-available/000-default.conf \`\`\` Inside that file, you will see a `` block starting on the first line. Add the following block of code inside the `` block and save the file: \`\`\`apache Options Indexes FollowSymLinks MultiViews AllowOverride All Require all granted \`\`\` This code uses the `Directory` directive to enable .htaccess within websites located in the /var/www/html directory. Restart Apache again to apply changes: \`\`\` sudo service apache2 restart \`\`\`

1. Create .htaccess file

Now you can create a `.htaccess` file in the root directory of your website. The `.htaccess` file will allow you to start creating SEO friendly URLs, such as redirecting old page URLs to new ones, removing file extensions, or creating pretty permalinks. A simple example of a rewrite rule in a .htaccess file: \`\`\`apache RewriteEngine On RewriteRule ^about$ /about.php [L] \`\`\` This rule allows users to navigate to www.yourwebsite.com/about instead of www.yourwebsite.com/about.php, which is friendlier for both Users and Search Engines.

Simply generate articles to optimize your SEO
Simply generate articles to optimize your SEO





DinoGeek offers simple articles on complex technologies

Would you like to be quoted in this article? It's very simple, contact us at dino@eiki.fr

CSS | NodeJS | DNS | DMARC | MAPI | NNTP | htaccess | PHP | HTTPS | Drupal | WEB3 | LLM | Wordpress | TLD | Domain name | IMAP | TCP | NFT | MariaDB | FTP | Zigbee | NMAP | SNMP | SEO | E-Mail | LXC | HTTP | MangoDB | SFTP | RAG | SSH | HTML | ChatGPT API | OSPF | JavaScript | Docker | OpenVZ | ChatGPT | VPS | ZIMBRA | SPF | UDP | Joomla | IPV6 | BGP | Django | Reactjs | DKIM | VMWare | RSYNC | Python | TFTP | Webdav | FAAS | Apache | IPV4 | LDAP | POP3 | SMTP

| Whispers of love (API) | Déclaration d'Amour |






Legal Notice / General Conditions of Use