内部重定向博客/ article.php?ID = 1到博客/条/ 1 [英] Internal Redirect blog/article.php?id=1 to blog/article/1

查看:190
本文介绍了内部重定向博客/ article.php?ID = 1到博客/条/ 1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个博客文件夹中的的public_html 文件夹,我的服务器与godaddy上。

I have a blog folder in the public_html folder on my server with godaddy.

本的.htaccess(在的public_html ):

The .htaccess (in public_html) :

RewriteEngine on
Options +FollowSymlinks -Multiviews -Indexes   
RewriteBase /

RewriteCond %{HTTPS} on
RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

RewriteCond %{THE_REQUEST} /blog/article\.php\?id=([^\s&]+) [NC]
RewriteRule ^ blog/article/%1? [R=302,L]
RewriteRule ^blog/article/([^/.]+)/?$ /blog/article.php?id=$1 [L,QSA,NC]

页带我到404页我与GoDaddy的在线主机上,但它工作正常在本地主机上。

The page takes me to 404 page on my online host with godaddy but it works fine on localhost.

我也试过:

RewriteCond %{QUERY_STRING} (^|&)article\.php\?id=(.*)(&|$)
RewriteRule ^(.*)/article.php$  $1/article/%1? [NC,L]

但这并没有做任何事情。

but that didn't do anything.

请帮忙!

推荐答案

想通了。对于任何人都可能会遇到同样的问题,这里是简单的解决办法:

Figured it out. For anyone that might run into the same problem, here is the simple solution:

请确保您的标记包含真实的URL。 我所做的就是,我把自定义URL在标签和GoDaddy的是不承认的。

Make sure that your tag contains the real url. What I did was, I put the custom url in the tag and godaddy was not recognizing it.

所以,我所做的就是

< A HREF =博客/条/ 1>第1条< / A>

相反,它应该是

< A HREF =博客/ article.php ID = 1?>第1条< / A>

这样,它会重定向到自定义网址正确。

That way it will redirect to the custom url correctly.

希望帮助!

这篇关于内部重定向博客/ article.php?ID = 1到博客/条/ 1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆