要配置.htaccess偽靜態規則,您需要在.htaccess文件中添加Rewrite規則。以下是一些常用的.htaccess偽靜態規則示例:
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]
請根據您的需求選擇適合的規則,并將其添加到.htaccess文件中。請注意,在配置之前,您需要確保服務器上已啟用了mod_rewrite模塊。