- 1 year ago
Htaccess allow end with dot
If you want to allow URLs to end with a dot (".") in your Apache server using an .htaccess
file, you can modify the rewrite rules to accommodate this behavior. By default, Apache treats URLs ending with a dot as invalid and returns a 404 Not Found error.
To allow URLs to end with a dot, you can add the following rule to your .htaccess
file:
apacheRewriteEngine On
RewriteCond %{REQUEST_URI} !/$
RewriteRule ^(.*[^/])$ /$1/ [L]
This rule checks if the requested URL does not end with a slash ("/"). If it doesn't, it adds a trailing slash to the URL using a redirect. This will allow URLs to end with a dot.
Make sure to place this code snippet in your .htaccess
file in the root directory of your Apache web server.
Additionally, you may need to adjust other rewrite rules or directives in your .htaccess
file to accommodate the behavior you desire. Keep in mind that modifying the .htaccess
file can have significant impacts on your website's functionality and security, so proceed with caution and make backups before making any changes.