【问题标题】:Friendly links with $_GET带有 $_GET 的友好链接
【发布时间】:2017-06-28 17:04:08
【问题描述】:

所以我有这样的链接:

mywebsite.com/index.php?sub=main

我想把它转换成

mywebsite.com/strona-glowna

【问题讨论】:

标签: php .htaccess get


【解决方案1】:

您需要借助 htaccess。 创建一个名为 .htaccess 的文件 并将这段代码粘贴到那里

AddDefaultCharset utf-8
Options +FollowSymlinks -Indexes
RewriteEngine on 
 RewriteBase /

 # skip all files and directories from rewrite rules below
 RewriteCond %{REQUEST_FILENAME} -d [OR]
 RewriteCond %{REQUEST_FILENAME} -f
 RewriteRule ^ - [L]
 RewriteRule ^/([^/]*)\strona-glowna$ index.php?sub=$1 [QSA,L]

如果这无济于事,请尝试用这个替换

RewriteRule    ^strona-glowna/([A-Za-z0-9-]+)/?$    index.php?sub=$1    [NC,L]    # Process parrots

【讨论】:

  • 试试这个我做了改变
猜你喜欢
  • 2020-02-09
  • 2023-03-15
  • 2012-04-27
  • 2010-11-01
  • 2011-12-03
  • 2012-06-05
  • 1970-01-01
  • 2012-09-17
  • 1970-01-01
相关资源
最近更新 更多