如何通过将.htacess添加到目录中来隐藏从URL中获取参数[复制]

This question already has an answer here:

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
</div>

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.