【问题标题】:htacces and the nice urlshtaccess 和漂亮的网址
【发布时间】:2013-12-04 23:27:47
【问题描述】:

我的网页上有此链接格式:

https://mypage.com/index2.php?page=registration
https://mypage.com/index2.php?page=food&category=1

第一种替换为:

https://mypage.com/registration (works well)

我想将第二个格式化为:

https://mypage.com/food/1 (doesn't work, the page is loaded, but the images don't)

所以我创建了以下 htaccess 文件:

RewriteEngine on
RewriteRule ^$ index.php [L]
RewriteRule ^([^/.]+)?$ index2.php?page=$1 [L]
RewriteRule ^food/([^/.]+)?$ index2.php?page=food&category=$1 [L]

但不起作用。 :( 这有什么问题?图片在哪里? 谢谢你的回答。

【问题讨论】:

    标签: .htaccess url seo nice


    【解决方案1】:

    (不起作用,页面已加载,但图像没有)

    可能是因为您的链接是相对的(不以/ 开头),并且当您在/food 之后有那个额外的斜杠时,它会更改URL 基础(尝试访问不存在的/food/ 中的图像目录)。将所有链接更改为绝对 URL 或在页眉中添加基础:

    <base href="/" />
    

    【讨论】:

      猜你喜欢
      • 2012-03-07
      • 1970-01-01
      • 2012-01-10
      • 2012-06-05
      • 2012-06-08
      • 2015-10-04
      • 2017-04-06
      • 1970-01-01
      • 2011-02-04
      相关资源
      最近更新 更多