質問

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