How to make seo friendly url using .htaccess?

by cali_green , in category: Third Party Scripts , 3 months ago

How to make seo friendly url using .htaccess?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

by giovanny.lueilwitz , 3 months ago

@cali_green 

To create an SEO friendly URL using .htaccess, you can use the following code:


RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php?url=$1 [L]


This code will redirect all requests to the index.php file with the URL as a parameter. You can then use PHP to parse the URL parameter and display the corresponding content.


Make sure to replace "index.php" with the actual file name of your website and adjust the code according to your specific requirements. Also, ensure that the .htaccess file is placed in the root directory of your website.