php - 301 htaccess redirect specific pages with extensions to no extension -


i 301 redirect specific file extension no extension , rule htaccess file looks this:

redirect 301 /myoldfile.php /my-new-file 

but, when upload htaccess file, website redirects me link , generates error:

www.domain.com/my-new-file?myoldfile.php 

so, appreciated, thanks

have way:

rewriteengine on rewritebase /  rewriterule ^myoldfile\.php$ /my-new-file [l,nc,r=302]  rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^(.*)$ index.php?$1 

make sure test after clearing browser cache.


Comments

Popular posts from this blog

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -