【问题标题】:.htaccess image display problem.htaccess 图片显示问题
【发布时间】:2011-04-09 00:50:14
【问题描述】:

htaccess 文件来重定向我的页面,如

site/pageTitle 到 index.php?id=pt

并显示类别中的文章 网站/文章/页面标题

现在 .htaccess 文件将我的图像文件夹视为目录目录并将图像视为 pageTitle 并且不显示图像 即使我将 url 指向图像,它也会显示文章页面

Options +FollowSymlinks
RewriteEngine on


RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d


#show urls like site/author/pageno

RewriteRule ^author/(.*)/(.*)$  index.php?author=$1&page=$2 [NC]
RewriteRule ^author/(.*)?$  index.php?author=$1&page=$2 [NC]

#show articles like site/article/articleTagName

RewriteRule ^article/(.*)/(.*)?$  index.php?article=$1 [NC]
RewriteRule ^article/(.*)?$  index.php?article=$1 [NC]


#direst article  site/articleTagName
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?article=$1 [L,QSA] 



#set image folder and user folder to real from virtual
RewriteRule ^(.*)/images/$ /images/

【问题讨论】:

    标签: image .htaccess directory


    【解决方案1】:

    请将最后一行替换为

    RewriteRule ^(.*)/images/(.*)$ images/$2
    

    我遇到了同样的问题,但我从您的编码中得到了提示并稍微更改了代码;现在它工作正常。

    【讨论】:

    • 如果我的路径 = www.test.com/img/test/12.jpg 正确的路径是 resource/image/test/12.jpg 我可以这样写吗? RewriteRule ^(.*)/img/$resource/image/$1
    猜你喜欢
    • 1970-01-01
    • 2015-09-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-03-10
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多