Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/url/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
借助.htaccess在Php中创建SEO友好的URL_.htaccess_Url_Mod Rewrite_Url Rewriting_Friendly Url - Fatal编程技术网

借助.htaccess在Php中创建SEO友好的URL

借助.htaccess在Php中创建SEO友好的URL,.htaccess,url,mod-rewrite,url-rewriting,friendly-url,.htaccess,Url,Mod Rewrite,Url Rewriting,Friendly Url,我想从以下内容创建我的URL: 对此: 并希望访问index.php中的上述查询字符串param作为$\u GET['title'] 为此,我编写了下面的.htaccess代码。但这不起作用 RewriteEngine On RewriteRule ^index?$ index.php RewriteRule ^index/([a-zA-Z0-9\-]+) index.php?title=$1 谁能帮我知道我做错了什么 谢谢。对于您展示的样品,请尝试以下内容。请确保在测试URL之前清除浏

我想从以下内容创建我的URL:

对此:

并希望访问index.php中的上述查询字符串param作为$\u GET['title']

为此,我编写了下面的.htaccess代码。但这不起作用

RewriteEngine On
RewriteRule ^index?$ index.php

RewriteRule ^index/([a-zA-Z0-9\-]+) index.php?title=$1
谁能帮我知道我做错了什么


谢谢。

对于您展示的样品,请尝试以下内容。请确保在测试URL之前清除浏览器缓存

RewriteEngine ON
##Rule for handling non-existing pages here to index.php file.
RewriteRule ^(A1-13-05-2021)/?$ index.php?title=$1 [QSA,NC,L]


通用规则:如果您想使其成为通用规则,请仅尝试以下规则

RewriteEngine ON
##Rule for handling non-existing pages here to index.php file.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(A1-\d{2}-\d{2}-\d{4})/?$ index.php?title=$1 [QSA,NC,L]