以下是一些常用的Apache Rewrite重寫規則:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.example\.com$ [NC]
RewriteRule ^(.*)$ http://example.com/$1 [R=301,L]
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php [L]
RewriteEngine On
RewriteRule ^oldpath/([^/]+)/([^/]+)$ newpath/$1/$2 [L]
RewriteEngine On
RewriteCond %{QUERY_STRING} ^id=(\d+)$
RewriteRule ^product\.php$ product/%1 [R=301,L]
這些只是一些常見的Rewrite規則示例,您可以根據您的需求進行自定義。