3

I am looking at this rule from an old site one of our old developers did, and I have never saw it.

RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www.)?domain.com$ [NC]
RewriteCond %{REQUEST_URI} ^/extension1/(.*)$ [OR]
RewriteCond %{REQUEST_URI} ^/extension2/(.*)$ [OR]
RewriteCond %{REQUEST_URI} ^/extension3/(.*)$
RewriteRule ^(.*)$ - [L,R=404]

I see that if I go to the domain with one of those extensions, it just 404's.

What I think is happening is if it matches the host, and one of the extenions, it just 404's. I understand everything up to the last line because the - throws me off.

What does the - do in the last rule?

Thanks

Devyn
  • 219
  • 1
  • 2
  • 15

1 Answers1

1

The - means "pass the URI through and do nothing". It essentially does nothing to the URI and only applies the flags, which in this case returns a 404.

For more info, see the mod_rewrite documentation under "- (dash)"

A dash indicates that no substitution should be performed (the existing path is passed through untouched). This is used when a flag (see below) needs to be applied without changing the path.

Jon Lin
  • 142,182
  • 29
  • 220
  • 220
  • 1
    Thank you. I couldn't find it there so that's why I asked here knowing someone would answer me. – Devyn Sep 06 '13 at 18:06