小编wda*_*vis的帖子

htaccess中的rewriterule以匹配某些文件扩展名

我如何查找某些文件扩展名的实例,如.(jpg | png | css | js | php),如果没有匹配,请将其发送到index.php?route = $ 1.

我希望能够允许自定义用户名的句点.

因此,将http://example.com/my.name重写为index.php?route = my.name

目前的设置:

的.htaccess:

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^.]+)$ index.php?route=$1 [QSA,L]
</IfModule>
Run Code Online (Sandbox Code Playgroud)

有用的:
http://example.com/userpage - > index.php?route = userpage
http://example.com/userpage/photos - > index.php?route = userpage/photos
http://example.com /file.js - > http://example.com/file.js
http://example.com/css/file.css - > http://example.com/css/file.css

除了上述内容我还需要工作:
http://example.com/my.name - > index.php?route = my.name

regex .htaccess mod-rewrite

13
推荐指数
2
解决办法
2万
查看次数

标签 统计

.htaccess ×1

mod-rewrite ×1

regex ×1