WebSite X5Help Center

3 ANTWORTEN
Nektarios K.
Nektarios K.
User
Autor

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

Mehr lesen
Gepostet am von Nektarios K.
Daniel W.
Daniel W.
User
Nutzer des Monats DENutzer des Monats 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.

    Mehr lesen
    Gepostet am von Daniel W.
    Nektarios K.
    Nektarios K.
    User
    Autor

    Dear Daniel,

    Thanks for your reply and instructions.

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

    Nek

    Mehr lesen
    Gepostet am von Nektarios K.