假设我有一个旧 URL http://abc.com/x.php?a=xyz&b=jkl我需要将所有请求重定向到页面 x.php 有查询字符串或没有到http://xyz.com /X/
以下是http://xyz.com根目录中的 .htaccess 文件
# Turn on URL rewriting
RewriteEngine On
RewriteBase /
# Protect application and system files from being viewed
RewriteRule ^(application|modules|system) - [F,L]
# Allow any files or directories that exist to be displayed directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $0 !=server-status
# Rewrite all other URLs to index.php/URL
RewriteRule .* index.php/$0 [PT,L]