目标:
使用该的href用户点击一篇文章的标题表中的链接:
< A HREF =。。article.php /".$输入/的$ id/$ web_title。>中$称号。 < / A>
我有这个URL重写我的htaccess文件:
I've got this URL rewrite in my htaccess file:
RewriteEngine On RewriteCond %{REQUEST_URI} ^/article/? RewriteCond %{REQUEST_FILE} !-f RewriteCond %{REQUEST_FILE} !-l RewriteRule ^(.*)$ article.php?post_type=$1&post_id=$2&post_name=$3 [QSA,L]
这是生产的网址: example/article.php/news/1/first-article-test 当用户访问 article.php 通过2点所述的链接。
Which is producing the URL: example/article.php/news/1/first-article-test when the user accesses article.php via a link described in point 2.
我试图删除上述网址 article.php 部分,因此它看起来就像这样: example/news/1/first-article-test
I'm trying to remove the article.php section from the above URL, so it looks just like this: example/news/1/first-article-test
目前在 article.php 页接收变量就好了,它是从基于 $ id数据库拉低其他数据通过了链接,但该URL显示 article.php /...。
At the moment the article.php page is receiving the variables just fine, it's pulling down other data from the database based on the $id passed by the link, but the URL is displaying article.php/....
推荐答案请您的规则是这样的:
RewriteEngine On RewriteCond %{REQUEST_FILE} !-f RewriteCond %{REQUEST_FILE} !-l RewriteCond %{REQUEST_URI} !^/article\.php [NC] RewriteRule ^(.+)$ /article.php/$1 [L]
这会让你有你的链接作为
It will let you have your links as
example/news/1/first-article-test更多推荐
隐藏URL htaccess的部分
发布评论