这是我的重定向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; ?>">
正常页面url为https://www.themobilesapp.com/Nokia-Lumia-638-specifications-3029
这工作正常,AMP页面url不工作https://www.themobilesapp.com/ampspecification/Nokia-Lumia-638-specifications-3029但当我添加安培规格时,这个放大器工作正常。php和其他应用程序。
但当是访问AMP页面url然后它显示我下面的错误:-
服务器内部错误服务器遇到内部错误或配置错误,无法完成您的请求。请联系webmaster@themobilesapp.com的服务器管理员,告知他们发生此错误的时间以及在此错误之前执行的操作。有关此错误的详细信息可在服务器错误日志中找到。此外,在尝试使用错误文档处理请求时,遇到了500内部服务器错误。
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>
你必须为这种情况写一个特定的规则,请尝试下面,让我知道结果。
RewriteRule ^ampspecification/([A-Za-z0-9-]+)$ ampspecification.php/$1 [L]
我假设你想重写页面ampspecification.php/test_url.
在上面,我们正在重写url,该url在开始时具有“AMPSSpecification”。
编辑:
RewriteRule ^ampspecification/([A-Za-z0-9-]+)$ specification.php?abc=$1 [L]
RewriteRule ^ampspecification/([A-Za-z0-9-]+) /ampspecification.php?abc=$1 [L]
这条代码行解决了我的问题。