문제

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.

도움이 되었습니까?

해결책

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]
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top