Might be a noob question but I am just beginning experimenting with apache and haven't found an exact answer yet.

I'm establishing an internet application using url-spinning massively, to exhibit nice web addresses like [mywebsite.com/product/x] rather than [mywebsite.com/application/remotes/product.php?id=x].

However, I'm able to still access the needed page by typing the url [mywebsite.com/application/remotes/product.php?id=x]. Let me allow it to be difficult, ie. redirect individuals to a mistake page when they achieve this, and permit them to access this site using the "rewritten" syntax only.

What will be the simplest method of doing that? And do you consider it's a necessary measure to secure an application?

Inside your PHP file, examine the $_SERVER['REQUEST_URI'] and make sure it is being utilized how you would like it to be.

There's pointless why this ought to be a burglar problem.

RewriteCond %{REDIRECT_URL} ! ^/app/controllers/product.php$
RewriteRule ^app/controllers/product.php$ /product/x [R,L]

RewriteRule ^product/(.*)$ /app/controllers/product.php?id=$1 [L]

The very first rule will redirect any request to /app/controllers/product.php without any REDIRECT_URL variable set towards the clean url. The Rewrite (last rule) sets this variable when calling the actual page and will not be rerouted.