我正在尝试隐藏URL ID
来自
android:persistent
至
http://localhost/download/view.php?s_id=T7bPo
ReWriteEngine On
RewriteRule ^view/([0-9]+) view.php?s_id=$1
我尝试了许多类似的代码行
RewriteRule ^view/([^/\.]+)?$ /view.php?s_id=$1 [L]
RewriteRule ^view/+?$ /view.php?s_id=$1 [NC,L]
但是每次都失败
错误 未找到对象
答案 0 :(得分:0)
如果您的.htaccess文件位于/ download /文件夹中,请在您的规则之上检查此规则:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^view\/(.*)$ /view.php?s_id=$1 [L]
</IfModule>
如果您的.htaccess文件位于/网站根文件夹中,请在您的规则之上检查此规则:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^download\/view\/(.*)$ /download/view.php?s_id=$1 [L]
</IfModule>
答案 1 :(得分:-1)
#remove php file extension-e.g. https://example.com/file.php will become https://example.com/file
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php [NC,L]
来自https://www.plothost.com/kb/how-to-remove-php-html-extensions-with-htaccess/