English 中文(简体)
Apache 重写/ 直接目录到查询字符串
原标题:Apache rewrite/redirect directory to querystring

我打算学习 模版的进进出出, 但我有一个问题,我想解决 之前,我开始这样做, 我可能只是 错过了一些小的东西 反正在这里。

我要强制将任何含有数字 [0-9]{1,4/code> 的目录重定向为单php文件,其中含有该数字的查询字符串。

例如,例如

http://example.com/23

http://example.com/23/

将改用于:

http://example.com?23

(.php文件是我的索引)

目前,我的情况如下:

RewriteCond  $/([0-9]{1,4})/^
RewriteRule  $/([0-9]+)^ ?%1 [R]

投出 500 ...

Thanks f或 your time.

最佳回答

尝试

RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([0-9]{1,4})$ ?$1 [QSA,L]
问题回答

暂无回答




相关问题
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 ...