0

How can i hide get parameters from URL using .htaccess? I don't want to change GET to POST but I rather like to add .htaccess into a directory named xxx where the the page is located to hide parameters from the URL

I tried this but it doesn't change anything

RewriteEngine on
RewriteRule ts125/xxx/(.*) imdetail.php?sid=$1
RewriteRule ts125/xxx/(.*) imdetail.php?sid=$1=$1
RewriteRule ts125/xxx/(.*) imdetail.php?sid=$1
Kin
  • 145
  • 11
  • What url are you going to and what do you expect to happen? – Amit Verma May 08 '16 at 03:44
  • @starkeen I want to hide all parameters after `.php` i want to show like this `www.example.com/ts125/xxx/imdetail.php` – Kin May 08 '16 at 03:46
  • Is your htaccess located in /xxx folder? – Amit Verma May 08 '16 at 04:08
  • yes its located in `/xxx` not in parent or publichtml. i also tried `RewriteEngine on RewriteRule http://example.com/ts125/xxx/imdetailt.php?sid=(.*) imdetailt.php` but nothing happens to url no error nothing – Kin May 08 '16 at 04:09

1 Answers1

0

You can use the following rule in /ts125/xxx/.htaccess

RewriteEngine on
RewriteBase /ts125/xxx
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ imdetail.php?sid=$1 [NC,L]

This will internally redirect

  • site.com/ts125/xxx/foobar

to

  • site.com/ts125/xxx/imdetail.php?sid=foobar.
Amit Verma
  • 38,175
  • 19
  • 80
  • 104
  • no luck doesnt do anything and i uploaded the file but i cant see the file listed may be i cant write `.htaccess` to the directory? May be thats the cause? – Kin May 08 '16 at 04:25