-1

My present url structure :

domain.com/items/view/5
domain.com/user/view/5
domain.com/user/edit/5

Now i don't want users to directly know the 'id' in the url, as they can directly fire a query from the address bar.
Hence i want to mask the url to :

domain.com

i.e. domain.com/anything will come as it is but the url will not change.

Thanks in advance.

Also note that i have already made .htaccess file with following code to remove 'index.php' from the url and that is working perfect.

    <IfModule mod_rewrite.c>
      RewriteEngine On
      RewriteBase /
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteRule ^(.*)$ /index.php/$1 [L]
    </IfModule>

1 Answers1

1

Can't be done. The only way to hide the id is to pass it outside the url - i.e. as POST data; but .htaccess doesn't have access to that, only the url.

Your code should instead handle the fact that users could enter the url directly and either act correctly or use a http-redirect header to send the user back to the main page.

Oliver Matthews
  • 7,497
  • 3
  • 33
  • 36
  • it is possible and have seen it working, but that was done through godaddy cpanel, but now i want to do with .htaccess directly. – Bhaumik Kothari Aug 23 '13 at 08:59
  • 'domain.com/items/view/5' this is already working perfectly..i have used codeigniter framework.i just want to trim everthing after domain.com – Bhaumik Kothari Aug 23 '13 at 10:33