我正在一个我想要网址的网站上工作
www.example.com/directory1/states/california.php
指向
www.example.com/directory1/california
城市页面也有类似的 url 更改:
www.example.com/directory1/cities/miami.php
应该指向
www.example.com/directory1/miami
我在访问文件中使用以下规则来更改 url:
RewriteRule ^directory1/(alabama|alaska|arizona|arkansas|california|colorado|connecticut|delaware|florida|georgia|guam|hawaii|idaho|illinois|indiana|iowa|kansas|kentucky|louisiana|maine|maryland|massachusetts|michigan|minnesota|mississippi|missouri|montana|nationwide|nebraska|nevada|new_hampshire|new_jersey|new_mexico|new_york|north_carolina|north_dakota|ohio|oklahoma|oregon|pennsylvania|rhode_island|south_carolina|south_dakota|tennesee|texas|us_virgin_islands|utah|vermont|virginia|washington|west_virigina|wisconsin|wyoming)$ /directory1/states/$1.php [L]
RewriteRule ^directory1/(.*)$ /directory1/cities/$1.php [L]
但是,网址栏中没有任何变化,我总是找不到 404。当我使用htaccess 检查器对其进行测试时,输出 url 总是正确的。我的规则有什么问题?有没有办法测试 mod_rewrite 如何/是否正常运行?