500 Internal Server Error is coming when i'm redirecting my normal page to AMP page htaccess error

不问归期 提交于 2020-01-11 10:33:08

问题


This is my normal page code for Redirect AMP page.

<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; ?>">

Normal page url is https://www.themobilesapp.com/Nokia-Lumia-638-specifications-3029

This is working fine and AMP page url is not working https://www.themobilesapp.com/ampspecification/Nokia-Lumia-638-specifications-3029 but this amp works fine when I add ampspecification.php and other passing.

But when is visit on AMP page url then it is showing me this below error:-

Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator at webmaster@themobilesapp.com to inform them of the time this error occurred, and the actions you performed just before this error. More information about this error may be available in the server error log. Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.

htaccess file with all codes

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>

回答1:


You have to write a specific rule for this condition please try with below and let me know the result.

RewriteRule ^ampspecification/([A-Za-z0-9-]+)$ ampspecification.php/$1 [L]

I am assuming you want to rewrite page to ampspecification.php/test_url.

In above we are rewriting the url which has 'ampspecification' at starting.

EDIT:

RewriteRule ^ampspecification/([A-Za-z0-9-]+)$ specification.php?abc=$1 [L]



回答2:


RewriteRule ^ampspecification/([A-Za-z0-9-]+) /ampspecification.php?abc=$1 [L]

This code line solve my problem.



来源:https://stackoverflow.com/questions/49001226/500-internal-server-error-is-coming-when-im-redirecting-my-normal-page-to-amp-p

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!