WebSite X5Help Center

3 RISPOSTE
Nektarios K.
Nektarios K.
User
Autore

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

Leggi di più
Postato il da Nektarios K.
Daniel W.
Daniel W.
User
Utente del mese DEUtente del mese 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.

    Leggi di più
    Postato il da Daniel W.
    Nektarios K.
    Nektarios K.
    User
    Autore

    Dear Daniel,

    Thanks for your reply and instructions.

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

    Nek

    Leggi di più
    Postato il da Nektarios K.