.htaccess url rewrite

匿名 (未验证) 提交于 2019-12-03 02:38:01

问题:

I want to rewrite a URL.

Let's say you visit http://files.domain.com/uploads/file_name.jpg

How can I use htaccess to write it so I can access it via http://files.domain.com/file_name.jpg?

Thanks.

回答1:

Try putting following lines in your root .htaccess file

RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_URI} ^/[^/]*\.jpg [NC] RewriteRule ^([^/]*\.jpg)$ /uploads/$1 [L,NC]  


文章来源: .htaccess url rewrite
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!