- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
Options +FollowSymlinks
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f # not a file
RewriteCond %{REQUEST_FILENAME} !-d # not a directory
RewriteRule ^(.+)$ index.php?params=$1 [L]
如你所见,我正在尝试转换任何类似的东西
mysite.com/x/y/z
到
mysite.com/index.php?params=x/y/z
但是,它不起作用。我尝试了 mysite.com/home 并在 index.php 的第一行放置了一个断点,但得到了 404。
关于为什么这对我不起作用的任何想法?谢谢你!
最佳答案
首先,确保在您的 Apache 服务器上启用了 mod_rewrite
。
然后去掉行尾的注释:
# not a file
RewriteCond %{REQUEST_FILENAME} !-f
# not a directory
RewriteCond %{REQUEST_FILENAME} !-d
From the Apache documentation :
Lines which begin with the hash character "#" are considered comments, and are ignored. Comments may not be included on a line after a configuration directive.
关于php - RewriteEngine 不在本地重写 URL?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4846339/
首先,在有人发布此链接之前,我会告诉您我已仔细阅读并尝试了它所说的内容,但无济于事。 .htaccess: Invalid command 'RewriteEngine', perhaps missp
我只是想知道是否有必要在每次添加重写时都包含 RewriteEngine On 和 Rewrite Base?例如,我想同时使用“从 URL ^ 中删除 QUERY_STRING”和“在一天中的特定时
索引文件存在并且可以工作。 当我用仅一行创建.htaccess文件时: RewriteEngine On 服务器上的任何页面都给我: Access forbidden! You don't have
我将 .htaccess 上传到服务器并收到错误 500(内部服务器错误)。 在错误日志中我有以下错误: .../.htaccess:此处不允许使用 RewriteEngine 但是 mod_rewr
我有这个.htaccess: RewriteEngine On RewriteRule ^/test$ /home.php 那么 mysite.com/home.php 和 mysite.com/te
我的 .htaccess 文件中有此代码,但我可以看到 RewriteEngine On重复几次。我可以删除一些 RewriteEngine On ? 我也很感兴趣 WP Rocket 的其余代码是否
我正在尝试提出我如何处理这样的文件的请求 /r/登录 但是有像 index.php 这样的服务器吗?r=login 我正在使用的这个 htaccess 代码似乎不起作用 Options +Follow
我创建了一个 url shortener,我正在使用重写规则,但是当我打开它时我的页面上的图像没有加载,这只是我第一次加载页面时的问题。如果我删除规则,加载页面,然后重新打开规则,图像将保留,但是当我
我的 Linux 服务器有问题。 配置:Linux 服务器 3.2.0-4-686-pae #1 SMP Debian 3.2.65-1+deb7u2 i686 Apache/2.2.22 (Debi
Options +FollowSymlinks RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f # not a file RewriteCon
尝试本地浏览 php 文件时出现此错误 [Fri Apr 13 19:16:40 2012] [alert] [client 127.0.0.1] C:/AppServ/www/hr-website/
任务看起来很简单: 所有请求都必须通过一个文件传递。 但是, 将以下代码添加到 httpd.conf 时: RewriteEngine On RewriteCond %{SCRIPT_FILENAM
目前我正在使用 OSX Server (Yosemite) 来托管一堆 PHP 应用程序,其中一些应用程序在网站文档根目录下有一个子目录用于子域。自更新到 Yosemite 版本的 OSX Serve
每当我的 ErrorDocument 上有 RewriteEngine - 部分不工作。这是我当前的 .htacces 文件: ErrorDocument 404 404.php Options -M
我有一个运行 Centos 6.6 和 Apaches 2.2.x 的 Linux 机器由于某些未知原因,打开重写引擎会导致 403 错误(无论我是否添加重写规则都会发生这种情况)。 我花了几个小时研
我使用 docker compose。但是,当我运行“docker-compose up”时,我遇到了一个错误:/var/www/html/.htaccess: Invalid command 'Re
我在 htaccess 中使用以下内容文件去除 .php我的文件的扩展名。它工作正常。 但是,我也想利用 ErrorDocument 404 /index.php将任何不存在的 url 重定向回主页。
我想知道当它嵌入 IfModule mod_rewrite.c 时,我是否只能在我的 htaccess 中使用 RewriteEngine On 一次,还是我必须每次都使用它,因为它是嵌入的? 请参阅
我使用 .htaccess 重写 url。请参阅下面的示例: 我的文件夹树状结构是这样的: 我的网站(文件夹) css(文件夹) 样式.css 我的页面.php .htaccess 当我调用 http
我正在尝试将诸如 www.mysite.com/foo/bar 之类的 URL 重定向到 www.mysite.com/foo/index.php?foo=bar . 为此,我在 .htaccess
我是一名优秀的程序员,十分优秀!