如何重定向结束URLS?

时间:2015-04-16 22:54:50

标签: .htaccess url

我不太确定术语是什么,但我想要做的就是在mydomain.com之后重定向URL,例如mydomain.com/todays-news。

我如何指出这个“今日新闻”网址让我们说一个目录中的文件就像投资组合一样?
你还把这个结尾的网址叫做什么?子域名?

1 个答案:

答案 0 :(得分:0)

SEF URL

将此添加到您的web_root/.htaccess

 RewriteEngine on 
 RewriteBase /
 RewriteCond %{REQUEST_FILENAME} !-d
 RewriteCond %{REQUEST_FILENAME} !-f
   RewriteRule ^todays-news/?$ /portfolio/some_file.php [NC,L]

rewriteRule会在内部将example.com/today-news重定向到example.com/portfolio/somefile