【问题标题】:create .html url on each image using php [closed]使用 php 在每个图像上创建 .html url [关闭]
【发布时间】:2013-06-17 04:17:50
【问题描述】:

我想在每个页面上像这样http://www.damnlol.com/the-new-instgram-facebook-filters-18142.html url

使用 PHP 现在我已经上传了图片,但显示如下 http://mysite.com/veiw_image?img=the-new-instgram-facebook-filters 要么 http://mysite.com/veiw_image?img=10 要么 http://mysite.com/?img=154858

但我想用 .html ext 唯一的 url 请帮忙!

【问题讨论】:

    标签: php url mod-rewrite


    【解决方案1】:

    如果您使用 Apache,请进行一些 URL 重写:Apache2 Guide to URL Rewrite

    【讨论】:

      【解决方案2】:

      如前所述,您必须在您的服务器上启用mod_rewrite,然后添加一个.htaccess 文件。

      RewriteEngine On
      RewriteRule ^view_image/([^/]*)\.html$ /view_image?img=$1 [L]
      

      这让您可以访问http://mysite.com/view_image/10.html 但也适用于您的其他示例。


      对于任何搜索的人,我认为您最初的意思是:

      RewriteEngine on
      RewriteRule ^(.+)\.jpeg$ $1.html
      

      这会改变扩展名

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2015-11-06
        • 2012-07-09
        • 2014-10-04
        • 1970-01-01
        • 1970-01-01
        • 2021-10-08
        相关资源
        最近更新 更多