Hey,
I am trying to make my url a bit prettier with apache mod_rewrite.
- html (root)
- css
- js
- layout
- sites (folder)
- profil.php
- work.php
- index.php
At the moment my url looks like this:
https://example.com/sites/profil.php
https://example.com/sites/work.php
And I want that it looks like this:
How can I can I overwrite the “sites folder” so, there is none and is it possible to remove the .php extension?
Thats how my apache config looks like:
<VirtualHost example.com>
DocumentRoot /var/www/example.com/html
ServerName example.com
ServerAlias www.example.com
<Directory "/var/www/example.com/html">
allow from all
Options None
Require all granted
</Directory>
RewriteEngine on
RewriteCond %{SERVER_NAME} =example.com [OR]
RewriteCond %{SERVER_NAME} =www.example.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
Do I need to edit my links after that change in my files?
2
Answers
Here are your mod rewrite rules
enter this into your
.htaccess
in the right location and give it a try.