问题
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