I'm have subfolder opencart website
.php redirect without .php
Here is an example of some of the following pages I need to move, basically anything in the pages folder needs to be moved down, also the old pages always redirect witout php.
http://www.example.com/subfolder/login.php to http://www.example.com/subfolder/login
http://www.example.com/subfolder/register.php to http://www.example.com/subfolder/register
http://www.example.com/subfolder/account.php to http://www.example.com/subfolder/account
Here is my htaccess :
# 1.To use URL Alias you need to be running apache with mod_rewrite enabled.
# 2. In your opencart directory rename htaccess.txt to .htaccess
# For any support issues please visit: http://www.opencart.com
Options +FollowSymlinks
# Prevent Directoy listing
Options -Indexes
# Prevent Direct Access to files
<FilesMatch "\.(tpl|ini|log)">
Order deny,allow
Deny from all
</FilesMatch>
# SEO URL Settings
RewriteEngine On
RewriteBase /subfolder/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]
redirect 301 /login.php http://www.example.com/subfolder/login
i will try above code. but nothing work properly
this post is regarding 301 Redirects with OpenCart 1.5 greater or Opencart 2.0 or greater.
Are you having a problem with your OpenCart SEO? Are you trying to add 301 Redirects?
Are you getting ?route= added to the end of your redirects and Error Not Found Message?
There are two ways to fix, that will work, it does however still change the target URL, you have to add ? yes a question mark!
First:
Here’s an example of what you need to use for a 301 Redirect in OpenCart .htaccess file:
Redirect 301 /subfolder/login.php http://www.example.com/subfolder/login?
Redirect 301 /subfolder/register.php http://www.example.com/subfolder/register?
Redirect 301 /subfolder/account.php http://www.example.com/subfolder/account?
OR
Redirect 301 /subfolder/login.php http://www.example.com/subfolder/login/?
Redirect 301 /subfolder/register.php http://www.example.com/subfolder/register/?
Redirect 301 /subfolder/account.php http://www.example.com/subfolder/account/?
Second:
just add below line in .htaccess file:
Redirect 301 ^subfolder/login.php$ http://www.example.com/subfolder/login [R=301,L]
Redirect 301 ^subfolder/register.php$ http://www.example.com/subfolder/register [R=301,L]
Redirect 301 ^subfolder/account.php$ http://www.example.com/subfolder/account [R=301,L]
I hope it's working fine.