WebSite X5Help Center

3 ANSWERS
Nektarios K.
Nektarios K.
User
Author

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

Read more
Posted on the from Nektarios K.
Daniel W.
Daniel W.
User
Best User of the month DEBest User of the month 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.

    Read more
    Posted on the from Daniel W.
    Nektarios K.
    Nektarios K.
    User
    Author

    Dear Daniel,

    Thanks for your reply and instructions.

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

    Nek

    Read more
    Posted on the from Nektarios K.