0

我知道有很多关于将所有页面重定向到特定域/index.php 或 html 页面的教程。
但是我需要将所有页面重定向到 ServerIP/myDirectory/ProjectName/index.php
,因为我在一个与客户共享它的办公室工作。所以在我的电脑上,我需要转到本地服务器上的目录,然后使用服务器的 wamp。

示例网址:http://192.168.0.100/myDirectory/ePortal/index.php

我怎样才能做到这一点?我的 htaccess 文件中有这个。

RewriteBase /myDirectory/ePortal/
RewriteRule .* index.php

但是这个 htaccess 是错误的。出现 500 内部错误。

4

2 回答 2

2

你可以试试这个:

# URLs not to redirect:
RewriteRule ^/?(captcha|My-Another-Url-Not-To-Redirect)\.php$ - [L]

# redirect all others:
RewriteRule ^/.* http://192.168.0.100/myDirectory/ePortal/index.php [L,R]

# or you may want only to redirect the homepage, then comment line above, put this:
#RewriteRule ^/index\.php http://192.168.0.100/myDirectory/ePortal/index.php [L,R]
于 2013-10-14T08:27:16.630 回答
0
<IfModule mod_rewrite.c>
RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.*)$/? index.php?url=$1 [PT,L]

</IfModule>

这会在重定向之前检查该文件是否不存在。也就是说,静态路径仍然有效:)

于 2013-10-14T08:34:39.983 回答