English 中文(简体)
Ignore Tiring slash with Papa Rewrite
原标题:Ignore trailing slash with Apache Rewrite

I m using mod_rewrite to redirect like so:

<代码>Rewrite Rules (work)/?$ 1.php [L]

这发送了以<代码>/work或/work/work.php结束的URL。

问题在于,如果将触角包括在内,那么它就把它视为一个目录,而不是它实际上的档案。 当然,这打破了我档案中的所有相对途径。

我不想在URL中下lash,但用任何方式将阿帕奇用于ignore<>。 拖拉 the,将URL作为档案处理,就像它没有大火吗?

最佳回答

由于你不想让URL像www.domain.com/work/。 你可以做些什么:

  RewriteEngine On
  RewriteRule ^work/$ http://www.domain.com/work%{REQUEST_URI} [R=301,L,NC]
  RewriteRule (work)$ $1.php [L,QSA,NC]

将把<代码>/work/改为/work/work/?page=main/work?page=main

问题回答

暂无回答




相关问题
Using SimplePie with CodeIgniter and XAMPP

I am using CodeIgniter 1.7.2 with XAMPP 1.7.2 on a Windows computer. I am trying to make use of SimplePie. I followed all the instructions I could find: a copy of simplepie.inc is in my applications/...

Multiple Sites with common files

I have developed over 50 sites that all use the exact same files other than CSS and IMAGES, I currently duplicate the files each time I create a new site and upload different css and images. What ...

http server validation

I finish a litle http server, writing from scratch. I would like to be sure that my imlementation is conforme to the HTTP specifications. W3C give us tools for HTML/XML conformance, but i see nothing ...