【问题标题】:Rewrite URL in SEO url重写 SEO url 中的 URL
【发布时间】:2021-04-23 20:40:14
【问题描述】:

我的网站有这样的网址

www.abc.com/search?service=computer

我想要

www.abc.com/service/computer

试过的htaccess文件是:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php
RewriteRule ([^/\.]+)/([^/\.]+)/?$ search.php?type=$1&service=$2

谢谢,请帮我在 SEO URL 中写下这个 URL

【问题讨论】:

  • 请在您的问题中分享您的 htaccess 规则文件,谢谢。
  • RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}\.php -f RewriteRule ^(.*)$ $1.php RewriteRule ([^/\.]+)/( [^/\.]+)/?$ search.php?type=$1&service=$2

标签: apache .htaccess mod-rewrite url-rewriting friendly-url


【解决方案1】:

请将您的 htaccess 文件保存在根文件夹/目录中并尝试以下规则。请确保在测试您的 URL 之前清除您的浏览器缓存。

RewriteEngine ON
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]*)/([^/]*)/?$  search?$1=$2 [L]

【讨论】:

    猜你喜欢
    • 2013-04-18
    • 2012-07-17
    • 2011-06-17
    • 2011-11-27
    • 1970-01-01
    • 2014-11-11
    • 2018-12-28
    • 1970-01-01
    • 2016-01-21
    相关资源
    最近更新 更多