How to only allow users to a page through a rewrite?

Posted by Pietu1998 on Stack Overflow See other posts from Stack Overflow or by Pietu1998
Published on 2013-11-11T15:46:06Z Indexed on 2013/11/11 15:53 UTC
Read the original article Hit count: 131

Filed under:
|
|

I have a website where I am using SSI to include some stuff to the front page. However, I'd like to show users an URL that ends with .html. I have accomplished that via a .htaccess and mod_rewrite redirect.

RewriteRule ^index\.html$ index.shtml [PT,L]

Also, I am using another redirect pointing to this URL to internally load the pages' content with JavaScript (example.html to index.html#example.html) with a condition for not redirecting index.html.

Now, I'd like to make the .shtml page 403 Forbidden. This is also easy:

RewriteRule ^index\.shtml - [F]

But, now index.html also gets forbidden.

I have tried adding L to the .html-to-.shtml rule, but this doesn't help. How could this problem be solved?

© Stack Overflow or respective owner

Related posts about apache

Related posts about .htaccess