简体   繁体   中英

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...

local: domain.com/bloco/590

web server: 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. 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. Otherwise this will need to be configured in your httpd.conf.

This will basically allow you to override configuration values in your .htaccess.

Modify your RewriteRule to look like this:

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

This assumes bloco.php is in your root. If it is not, you will need to specify the path to it:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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