简体   繁体   English

Web服务器上的.htaccess文件中的“ RewriteEngine On”错误

[英]Error with “RewriteEngine On” in .htaccess file on web server

RewriteEngine On
RewriteRule ^bloco/(.*)$ bloco.php?id=$1
RewriteRule ^bloco/(.*)/$ bloco.php?id=$1

My .htaccess file have that configuration, work well on my local server but at web server dont work... 我的.htaccess文件具有该配置,在我的本地服务器上运行良好,但在Web服务器上却无法运行...

local: domain.com/bloco/590 本地:domain.com/bloco/590

web server: domain.com/bloco/?id=590 网络服务器:domain.com/bloco/?id = 590

right now (not working...) 目前(无法运作...)

Options +FollowSymLinks

Options -Indexes

RewriteEngine On
RewriteEngine On
RewriteRule ^bloco/(.*)(/?)$ /carnaval/blocosderua/bloco.php?id=$1 [NC,L]

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ $1\.php

php_value allow_url_fopen 1
php_value allow_url_include 1

any help? 有什么帮助吗?

Not all hosting companies allow you to use the rewrite engine. 并非所有托管公司都允许您使用重写引擎。 If your getting an error try to see if it also does with only the RewriteEngine On rule. 如果遇到错误,请尝试仅使用RewriteEngine On规则来查看是否也是如此。 If it does I'm afraid your not allowed to use it. 如果这样做,恐怕您不允许使用它。

As for the rules they look fine to me. 至于规则,它们在我看来还不错。

Greets Michael 问候迈克尔

You probably need to include Options +FollowSymLinks at the top of your .htaccess. 您可能需要在.htaccess的顶部包括Options + FollowSymLinks。 Otherwise this will need to be configured in your httpd.conf. 否则,这需要在您的httpd.conf中进行配置。

This will basically allow you to override configuration values in your .htaccess. 基本上,这将使您可以覆盖.htaccess中的配置值。

Modify your RewriteRule to look like this: 修改您的RewriteRule如下所示:

RewriteEngine On
RewriteRule ^bloco/(.*)(/?)$ /bloco.php?id=$1 [NC,L]

This assumes bloco.php is in your root. 这假定bloco.php在您的根目录中。 If it is not, you will need to specify the path to it: 如果不是,则需要指定其路径:

RewriteRule ^bloco/(.*)(/?)$ /path/to/bloco.php?id=$1 [NC,L]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM