【发布时间】:2018-08-06 15:51:00
【问题描述】:
这是我的重定向 AMP 页面的正常页面代码。
<meta name="original-source" content="https://www.themobilesapp.com/<?= $abc; ?>">
<link rel="canonical" href="https://www.themobilesapp.com/<?= $abc; ?>">
<link rel="amphtml" href="https://www.themobilesapp.com/ampspecification/<?= $abc; ?>">
正常的页面网址是 https://www.themobilesapp.com/Nokia-Lumia-638-specifications-3029
这工作正常,AMP 页面网址不起作用https://www.themobilesapp.com/ampspecification/Nokia-Lumia-638-specifications-3029 但是当我添加 ampspecification.php 和其他传递时,这个放大器工作正常。
但是当访问 AMP 页面 url 时,它会向我显示以下错误:-
Internal Server Error 服务器遇到内部错误或 配置错误,无法完成您的请求。请 通过 webmaster@themobilesapp.com 联系服务器管理员以 告知他们此错误发生的时间,以及您采取的措施 在此错误之前执行。有关此错误的更多信息 可能在服务器错误日志中可用。此外,一个 500 内部 尝试使用服务器时遇到服务器错误错误 ErrorDocument 来处理请求。
包含所有代码的 htaccess 文件
Options +FollowSymLinks -MultiViews -Indexes
<IfModule mod_rewrite.c>
DirectoryIndex index.php
RewriteCond %{HTTP_HOST} ^themobilesapp.com$ [NC]
RewriteRule (.*) https://www.themobilesapp.com/$1 [R=301,L]
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php
ErrorDocument 404 404error.php
RewriteRule ^([A-Za-z0-9-]+)$ specification.php?abc=$1 [L]
RewriteRule ^news/([A-Za-z0-9-]+)?$ news.php?abc=$1 [L]
RewriteRule ^ampnews/([A-Za-z0-9-]+)?$ ampnews.php?abc=$1 [L]
RewriteRule ^profile/([A-Za-z0-9-]+)?$ profile.php?id=$1 [L]
</IfModule>
【问题讨论】:
-
你能解决我的问题@abhishek-gurjar 吗?
-
我正在查看它,它正在工作themobilesapp.com/ampspecification.php/…
-
你想从 ampspecification 部分中删除 .php,对吗?
-
是的..正是..你是对的....
-
工作 url 是 themobilesapp.com/… 但我想让它像 themobilesapp.com/ampspecification/… 一样干净。如果你点击上面的链接,你会发现一个错误
标签: .htaccess url url-rewriting url-redirection