【发布时间】:2016-01-27 00:43:51
【问题描述】:
我必须在我的网站上重写一些网址。我把它放在我的 htaccess 中以进行此更改: http://example.com/john/?a=1&b=2 --> http://example.com/index.php?account=john&a=1&b=2
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([a-zA-Z0-9_-]+)/?$ ./index.php?account=$1 [NC,QSA,L]
现在我必须以这种方式重写图像 url。具有此路径的每张图片:example.com/john/images/a.jpg
应该指向物理路径:example.com/accounts/john/images/a.jpg
我该怎么做?
注意:“John”不是固定的,而是所有可能的词。
【问题讨论】:
标签: .htaccess mod-rewrite url-rewriting