简体   繁体   中英

.htaccess redirect works, but not rewrite

here is my .htaccess file, it works because the first rewriterule correctly redirects .html -> .php, but I am hoping to remove the .php extension also. if anyone could help me correct my code here I'd appreciate it.

Options +FollowSymlinks
RewriteEngine on
RewriteRule ^(.+)\.html$ http://vbwtest.comeze.com/$1.php [R,NC]

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^([^/]+)/$ $1.php

Try this.This will rewrite all your requests.

Options +FollowSymlinks
RewriteEngine on
RewriteRule ^(.*)\.html$ $1.php [nc]

Remove the R flag from your rewrite rule:

 RewriteRule ^(.+)\.html$ http://vbwtest.comeze.com/$1.php [NC]

The R in [R,NC] tells it to redirect instead of just rewriting.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM