URL 重寫由 `mod_rewrite.so` 實現。需確認:
DocumentRoot /opt/www
Options FollowSymLinks
AllowOverride All # 允許 .htaccess 覆蓋
Order allow,deny
Allow from all
`AllowOverride All` 讓 Apache 讀取各站點目錄下 `.htaccess` 實現分佈式重寫規則。
# Slackware /etc/rc.d/rc.httpd restart
# Ubuntu/Debian /etc/init.d/apache2 restart
# RHEL/CentOS /etc/init.d/httpd restart
Options +FollowSymLinks
RewriteEngine on
# 搜索/每日/無回覆
RewriteRule ^getdaily\.html$ search.php?do=getdaily [L]
RewriteRule ^getdaily([0-9]+)\.html$ search.php?do=getdaily&f=$1 [L]
RewriteRule ^unanswered\.html$ search.php?do=process&replyless=1&replylimit=0&dontcache=1 [L]
RewriteRule ^unanswered([0-9]+)\.html$ search.php?do=process&replyless=1&replylimit=0&dontcache=1&forumchoice=$1&childforums=1 [L]
# 版塊/公告/主題/帖子
RewriteRule ^forum([0-9]+)\.html$ forumdisplay.php?f=$1 [L]
RewriteRule ^forum([0-9]+)-([0-9]+)-([a-z]+)-(.*)-([0-9]+)-(.*)\.html$ forumdisplay.php?f=$1&page=$2&sort=$3&order=$4&pp=$5&daysprune=$6 [L]
RewriteRule ^announcement([0-9]+)\.html$ announcement.php?f=$1 [L]
RewriteRule ^thread([0-9]+)\.html$ showthread.php?t=$1 [L]
RewriteRule ^thread([0-9]+)-([0-9]+)\.html$ showthread.php?t=$1&page=$2 [L]
RewriteRule ^post([0-9]+)\.html$ showthread.php?p=$1 [L]
RewriteRule ^post([0-9]+)-([0-9]+)\.html$ showpost.php?p=$1&postcount=$2 [L]
... (更多規則見原文)
配套 XML 插件:導入 `vbburlhack.xml` 替換模板輸出鏈接為靜態格式,實現前後端一致。
Apache URL 重寫三步走:載入模塊 → Directory AllowOverride All → 編寫規則 (.htaccess 或主配置)。vBulletin 需手工規則 + XML 插件雙管齊下;Drupal 開箱即用。乾淨 URL 不僅利於 SEO (Google 更快收錄),更能屏蔽內部技術細節、提升安全性與可維護性。建議所有公開站點強制啟用 Clean URLs。