0

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.

andrewdotn
  • 32,721
  • 10
  • 101
  • 130
Zain Baloch
  • 410
  • 5
  • 9

1 Answers1

1

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]
RobertB
  • 4,592
  • 1
  • 30
  • 29
  • thank you for the reply but that doesn't solve my problem, also a point i forgot to mention was: in the first place i want to remove this period because it gives me a 403 error. i will paste the whole .htaccess file from office for better understanding of the problem. – Zain Baloch Dec 01 '12 at 17:21
  • @ZainBaloch, can you clarify what you mean by "it's not working"? What behavior, exactly, are you expecting? What behavior, exactly, are you instead seeing? – RobertB Dec 05 '12 at 19:20