I have the following htaccess:
RewriteEngine On
RewriteBase /
# Protect hidden files from being viewed
<Files .*>
Order Deny,Allow
Deny From All
</Files>
# Allow any files or directories that exist to be displayed directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Rewrite all other URLs to index.php/URL
RewriteRule .* index.php/$0 [PT]
If I type in the URL: https://www.example.com//////product/////id/////name
It shows me my product but the URL with all those slashes.
I tried to remove them by add two new rewrite rules as below:
RewriteEngine On
RewriteBase /
# Protect hidden files from being viewed
<Files .*>
Order Deny,Allow
Deny From All
</Files>
# Allow any files or directories that exist to be displayed directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Rewrite all other URLs to index.php/URL
RewriteRule .* index.php/$0 [PT]
RewriteCond %{THE_REQUEST} s[^?]*//
RewriteRule ^.*$ /$0 [R=302,L,NE]
They are removed now but the index.php comes back in the URL like: https://www.example.com/index.php/product/id/name which I don’t want.
How can I solve this please?
2