user2488354
user2488354

Reputation: 67

Mod Rewrite link, and disable original

I have a working mod-rewrite.

RewriteEngine On
RewriteRule ^notifications$ /notifications.php [L]

However, I've seen on some sites, their links seems to be all like website.com/login website.com/notifications website.com/profile

I think I have achieved the same results with my mod-rewrite. But how can I prevent users from entering my /notifications.php page like how some other website does?

Thanks!

Upvotes: 0

Views: 30

Answers (1)

Jon Lin
Jon Lin

Reputation: 143916

Add another rule that looks for a direct request for the php file and redirect it to the non php URL:

RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /notifications\.php
RewriteRule ^ /notifications [L,R=301]

Upvotes: 1

Related Questions