HT访问配置漂亮的URL



我正在开发一个网站,我需要获得漂亮的网址。

在花了几个小时阅读大量教程后,它总是给我一个错误。

我在根目录 (www.mysite.com/.htaccess) 中创建 .htaccess 文件。

我会从 www.mysite.com/subdirectory/news.php 到www.mysite.com/subdirectory/news/ 的网址

我试过

RewriteRule ^subdirecotry/news.php$ www.mysite.com/subdirectory/news [L]

但它没有用。谢谢!

你可以试试:

RewriteCond %{THE_REQUEST} ^[A-Z]{3,}s/+(subdirecotry/news).php/?s [NC]
RewriteRule ^ /%1 [R,L]
RewriteRule ^(subdirecotry/news)/?$ /$1.php [L,NC]

最新更新