Pregunta

I am trying to redirect a URL using a .htaccess file. The URL structure is like:

http://mydomain.com/folder/.anything_goes_here

Note the dot in the above Url. I want to remove it somehow using .htaccess.

I have tried using RewriteRule but it's not working. Here is the code I used:

RewriteEngine on
RewriteBase /
RewriteRule ^/folder/.(.*+)/?$ /folder/$1 [L]

Any help would be highly appreciated. Thank you.

¿Fue útil?

Solución

The period has a special meaning in regular expressions (it means "any character"). In order to explicitly specify a period, you need to escape it.

RewriteRule ^/folder/\.(.*+)/?$ /folder/$1 [L]
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top