WebSite X5Help Center

3 RéPONSES
Nektarios K.
Nektarios K.
User
Auteur

I use this in .htaccess, but show Page not found 404...

# remove .php; use THE_REQUEST to prevent infinite loops RewriteCond %{HTTP_HOST} ^www\.pamsmaritime\.com RewriteCond %{THE_REQUEST} ^GET\ (.*)\.php\ HTTP RewriteRule (.*)\.php$ $1 [R=301]

# remove index RewriteRule (.*)index$ $1 [R=301]

# remove slash if not directory RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} /$ RewriteRule (.*)/ $1 [R=301]

# add .php to access file, but don't redirect RewriteCond %{REQUEST_FILENAME}.php -f RewriteCond %{REQUEST_URI} !/$ RewriteRule (.*) $1\.php [L]

Any solution?

Nek

Lire plus
Posté le de Nektarios K.
Daniel W.
Daniel W.
User
Meilleur utilisateur du mois DEMeilleur utilisateur du mois EN

Here is the answer from Google AI, although I don't know if the answer is correct.

----- Google AI -----

.htaccess file:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*)$ $1.php [NC,L]

Important: After inserting these rules, you must adjust the links in your HTML code, i.e. change ...

href="page-abc.php" >> href="page-abc"

-----

If it doesn't work, then wait for the experts.

    Lire plus
    Posté le de Daniel W.
    Nektarios K.
    Nektarios K.
    User
    Auteur

    Dear Daniel,

    Thanks for your reply and instructions.

    I will try it, and I will let you know.

    Nek

    Lire plus
    Posté le de Nektarios K.