Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/url/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.htaccess 如何使用htaccess更改opencart项目的URL?_.htaccess_Url_Opencart - Fatal编程技术网

.htaccess 如何使用htaccess更改opencart项目的URL?

.htaccess 如何使用htaccess更改opencart项目的URL?,.htaccess,url,opencart,.htaccess,Url,Opencart,我有一个opencartproject的URL问题 我安装了oepncartproject,但其URL为: http://www.exmaple.com/opencart/upload 但我想把它显示为: http://www.exmple.com/demo使用.htaccess 我怎样才能改变它 请提供任何帮助。尝试将其添加到文档根目录的htaccess文件中: RewriteEngine On RewriteRule ^demo$ /opencart/upload [L] Rewrite

我有一个
opencart
project的URL问题

我安装了
oepncart
project,但其URL为:

http://www.exmaple.com/opencart/upload
但我想把它显示为:

http://www.exmple.com/demo
使用
.htaccess

我怎样才能改变它


请提供任何帮助。

尝试将其添加到文档根目录的htaccess文件中:

RewriteEngine On
RewriteRule ^demo$ /opencart/upload [L]
RewriteEngine On                # Already in there

RewriteBase /opencart/upload/   # Already there but with value / only

我认为您需要修改
RewriteBase
以从文档根目录指向您的子目录:

RewriteEngine On
RewriteRule ^demo$ /opencart/upload [L]
RewriteEngine On                # Already in there

RewriteBase /opencart/upload/   # Already there but with value / only
然后当然要使用重写规则:

RewriteRule ^demo$ /opencart/upload [QSA]   # Add this before the next line that is already there
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]