Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/5.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_Mod Rewrite_Redirect_Opencart - Fatal编程技术网

.htaccess文件不工作?

.htaccess文件不工作?,.htaccess,mod-rewrite,redirect,opencart,.htaccess,Mod Rewrite,Redirect,Opencart,我正在使用下面opencart的默认.htaccess文件,我手动添加了最后2行 RewriteBase / RewriteRule ^sitemap.xml$ index.php?route=feed/google_sitemap [L] RewriteRule ^googlebase.xml$ index.php?route=feed/google_base [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILEN

我正在使用下面opencart的默认.htaccess文件,我手动添加了最后2行

RewriteBase /
RewriteRule ^sitemap.xml$ index.php?route=feed/google_sitemap [L]
RewriteRule ^googlebase.xml$ index.php?route=feed/google_base [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !.*\.(ico|gif|jpg|jpeg|png|js|css)
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]

RewriteCond %{REQUEST_URI} diger_olcu_aletleri
RewriteRule ^diger_olcu_aletleri$ http://www.hirdavatdeposu.com/diger-olcu-aletleri
我已经使用该网站进行了检查(http://htaccess.madewithlove.be/)它改变了我的网址

迪格尔·奥尔库·阿莱特利

迪格尔·奥尔库·阿莱特利

正如预期的那样,但是它在我的网站上不起作用。有什么问题吗

下面是我完整的.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
# If your opencart installation does not run on the main web folder make sure you folder it does run in ie. / becomes /shop/ 

RewriteBase /
RewriteRule ^sitemap.xml$ index.php?route=feed/google_sitemap [L]
RewriteRule ^googlebase.xml$ index.php?route=feed/google_base [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !.*\.(ico|gif|jpg|jpeg|png|js|css)
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]

RewriteCond %{REQUEST_URI} diger_olcu_aletleri
RewriteRule ^diger_olcu_aletleri$ http://www.hirdavatdeposu.com/diger-olcu-aletleri

### Additional Settings that may need to be enabled for some servers 
### Uncomment the commands by removing the # sign in front of it.
### If you get an "Internal Server Error 500" after enabling any of the following settings, restore the # as this means your host doesn't allow that.

# 1. If your cart only allows you to add one item at a time, it is possible register_globals is on. This may work to disable it:
# php_flag register_globals off

# 2. If your cart has magic quotes enabled, This may work to disable it:
# php_flag magic_quotes_gpc Off

# 3. Set max upload file size. Most hosts will limit this and not allow it to be overridden but you can try
# php_value upload_max_filesize 999M

# 4. set max post size. uncomment this line if you have a lot of product options or are getting errors where forms are not saving all fields
# php_value post_max_size 999M

# 5. set max time script can take. uncomment this line if you have a lot of product options or are getting errors where forms are not saving all fields
# php_value max_execution_time 200

# 6. set max time for input to be recieved. Uncomment this line if you have a lot of product options or are getting errors where forms are not saving all fields
# php_value max_input_time 200
#1.要使用URL别名,您需要在启用mod#u rewrite的情况下运行apache。
# 2. 在opencart目录中,将htaccess.txt重命名为.htaccess。
#有关任何支持问题,请访问:http://www.opencart.com
选项+FollowSymlinks
#防止Directoy上市
选项-索引
#阻止直接访问文件
命令拒绝,允许
全盘否定
#搜索引擎优化URL设置
重新启动发动机
#如果您的opencart安装没有在主web文件夹上运行,请确保您的文件夹在ie中运行。/been/shop/
重写基/
重写规则^sitemap.xml$index.php?route=feed/google_sitemap[L]
重写规则^googlebase.xml$index.php?route=feed/google_base[L]
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写条件%{REQUEST\u URI}!。*\。(ico | gif | jpg | jpeg | png | js | css)
RewriteRule^([^?]*)index.php?_route_uu=$1[L,QSA]
重写cond%{REQUEST_URI}diger_olcu_aletleri
重写规则^diger\u olcu\u aletleri$http://www.hirdavatdeposu.com/diger-olcu-aletleri
###某些服务器可能需要启用的其他设置
###通过删除前面的#符号来取消对命令的注释。
###如果在启用以下任何设置后出现“内部服务器错误500”,请恢复#,因为这意味着您的主机不允许这样做。
# 1. 如果您的购物车一次只允许您添加一个项目,则可以启用register_globals。这可能会禁用它:
#php_标志寄存器_全局关闭
# 2. 如果您的购物车启用了魔法报价,这可能会使其禁用:
#php_标志魔术_引号_gpc关闭
# 3. 设置最大上载文件大小。大多数主机将对此进行限制,并且不允许覆盖它,但您可以尝试
#php_值上传_最大_文件大小999M
# 4. 设置最大邮件大小。如果有很多产品选项或表单未保存所有字段时出现错误,请取消对此行的注释
#php_值post_最大尺寸999M
# 5. 设置脚本可以花费的最大时间。如果有很多产品选项或表单未保存所有字段时出现错误,请取消对此行的注释
#php_值最大执行时间200
# 6. 设置接收输入的最长时间。如果有很多产品选项或表单未保存所有字段时出现错误,请取消对此行的注释
#php_值最大输入时间200

OpenCart
的最后一行。htaccess
规则基本上捕获任何内容,然后停止。在
RewriteBase
行之后尝试两行,因为这应该可以工作。
.htaccess
文件逐行检查,最后一行OC上的
[L,QSA]
中的
L
意味着在该行运行后停止

我们遇到了另一个问题,OpenCart SEO URL没有显示。所有谷歌搜索都指向我们启用mod_重写。我们问题的解决方案与其他人发布的略有不同,因此我想我会在其他人可能也会找到的地方分享

我们的平台:

-Linux版本2.6.32-042stab111.11
(root@kbuild-rh6-x64.eng.sw.ru)(gcc版本4.4.6 20120305(红色 第4.4.6-4节(GCC))#1 SMP周二9月1日18:19:12 MSK 2015

-CentOS 6.8版(最终版)-内核\r\n在

服务提供商:railsplayground.com

我们按照OpenCart的指定正确创建了.htaccess文件 http://cp.htaccess.txt.htaccess

但是这个打破了OpenCart显示给我们的所有页面

在咬牙切齿之后,我们开始注释掉.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
# If your opencart installation does not run on the main web folder make sure you folder it does run in ie. / becomes /shop/ 

RewriteBase /
RewriteRule ^sitemap.xml$ index.php?route=feed/google_sitemap [L]
RewriteRule ^googlebase.xml$ index.php?route=feed/google_base [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !.*\.(ico|gif|jpg|jpeg|png|js|css)
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]

RewriteCond %{REQUEST_URI} diger_olcu_aletleri
RewriteRule ^diger_olcu_aletleri$ http://www.hirdavatdeposu.com/diger-olcu-aletleri

### Additional Settings that may need to be enabled for some servers 
### Uncomment the commands by removing the # sign in front of it.
### If you get an "Internal Server Error 500" after enabling any of the following settings, restore the # as this means your host doesn't allow that.

# 1. If your cart only allows you to add one item at a time, it is possible register_globals is on. This may work to disable it:
# php_flag register_globals off

# 2. If your cart has magic quotes enabled, This may work to disable it:
# php_flag magic_quotes_gpc Off

# 3. Set max upload file size. Most hosts will limit this and not allow it to be overridden but you can try
# php_value upload_max_filesize 999M

# 4. set max post size. uncomment this line if you have a lot of product options or are getting errors where forms are not saving all fields
# php_value post_max_size 999M

# 5. set max time script can take. uncomment this line if you have a lot of product options or are getting errors where forms are not saving all fields
# php_value max_execution_time 200

# 6. set max time for input to be recieved. Uncomment this line if you have a lot of product options or are getting errors where forms are not saving all fields
# php_value max_input_time 200
结果是第一行

         Options +FollowSymlinks
断绝了我们的联系。删除这一行完全使搜索引擎优化网址工作得很好

此外,请确保在SEO URL之前或之后都没有/

希望这能帮助别人