i had an htaccess for that, but the problem is... it doesn't read $_POST variables

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/$ $1.php
RewriteRule ^([^/]+)/([^/]+)/$ /$1/$2.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/)$
RewriteRule (.*)$ /$1/ [R=301,L]

Anyone know an htaccess that can remove the .php, add a trailing slash at the end and can read $_POST data. pls help

Recommended Answers

All 2 Replies

This should work.

    <IfModule mod_rewrite.c>
        RewriteEngine On
        RewriteBase /
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteRule (.*) $1.php [L]
    </IfModule>

aw thanks for the reply im gonna reserve your solution. because my htaccess code works but i edited the last part

RewriteRule (.*)$ /$1/ [R=301,L]

to

RewriteRule (.*)$ /$1/ [NC,P]
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.