如何使用opencart 2从url中删除上传文件夹?

时间:2016-01-09 12:57:50

标签: php .htaccess opencart opencart2.x

我想从opencart网址中删除上传文件夹。我试过以下代码

RewriteEngine on
RewriteBase /
# Redirect non-www to www
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

# Route all request to production folder
#RewriteRule ^(.*)$ upload/$1[L]

RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www.)?siteName.ae$
RewriteCond %{REQUEST_URI} !^upload/

RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.*)$ upload/$1
RewriteCond %{HTTP_HOST} ^(www.)?siteName.ae$ 
RewriteRule ^(/)?$ upload/ [L]

但是当我添加此代码时,登录无效。

2 个答案:

答案 0 :(得分:0)

您需要将重写基础更改为/ {foldername here} /

答案 1 :(得分:0)

试试这个:

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} !^/upload/
RewriteRule ^(.*)$ /upload/$1 [L]