要配置.htaccess偽靜態(tài)規(guī)則,您需要在.htaccess文件中添加Rewrite規(guī)則。以下是一些常用的.htaccess偽靜態(tài)規(guī)則示例:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^([^\.]+)$ $1.php [NC,L]
RewriteEngine On
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^([^\.]+)\.html$ $1.php [NC,L]
RewriteEngine On
RewriteRule ^old-url$ /new-url [R=301,L]
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
請根據(jù)您的需求選擇適合的規(guī)則,并將其添加到.htaccess文件中。請注意,在配置之前,您需要確保服務(wù)器上已啟用了mod_rewrite模塊。