500 Internal server error occurs when I redirect my regular page to htaccess error on AMP page

This is my regular page code for a 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; ?>">

The normal URL is https://www.themobilesapp.com/Nokia-Lumia-638-specifications-3029

This works fine and the AMP page URL doesnโ€™t work https://www.themobilesapp.com/ampspecification/Nokia-Lumia-638-specifications-3029 but this amplifier works fine when I add ampspecification.php and other transfer.

But when you visit the URL of the AMP page, it shows me this error below: -

Internal server error The server detected an internal error or incorrect configuration and your request could not be completed. please contact the server administrator at webmaster@themobilesapp.com. inform them about the time when this error occurred, and about the actions that you performed before this error. Additional information about this error may be available in the server error log. In addition, a 500 internal server error failed while trying to use ErrorDocument to process 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>
+2
source share
2 answers
RewriteRule ^ampspecification/([A-Za-z0-9-]+) /ampspecification.php?abc=$1 [L]

This line of code solves my problem.

0
source

, , .

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

, ampspecification.php/test_url.

url, "ampspecification" .

EDIT:

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

Source: https://habr.com/ru/post/1669652/


All Articles