我经常搜索,但没有找到任何东西。
我正在使用codeigniter。 我目前的网址是: base_url/content_controller/content_download/download_id 但是,我需要这样做: base_url/download_id
因为下载ID是数字,我的.htaccess不起作用。
RewriteRule ^download/content/2$ 2 [L]如果没有.htaccess,请告诉我如何解决这个问题。
I've searched a lot, but didn't find anything.
I am using codeigniter. my current url is: base_url/content_controller/content_download/download_id but, I need to do it: base_url/download_id
as download id is numeric, my .htaccess doesn't work.
RewriteRule ^download/content/2$ 2 [L]Please tell me how to solve that and if there is any way to do it without .htaccess.
最满意答案
你的意思是这样的吗?
RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^([0-9]+)$ /download/content/$1 [L]因此,如果您请求http://example.com/123 ,则URI将被重写为/download/content/123 。
Thanks Jon, I tried several times but multiple rule conflicts. So I do it in another way. when I hit the URL http://www.example.com/2/ it shows Not Found. So, I use 404 controller to handle the numeric value. Finally I have done it.
更多推荐
发布评论