重定向到.htaccess目录的index.php

时间:2015-03-06 07:48:27

标签: apache .htaccess mod-rewrite

在.htaccess代码中写为

RewriteEngine On
# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)?$ /project/index.php/$1 [L]

但是这个.htaccess重定向到我的web根目录的index.php而不是项目的。我有直接在root用户安装wordpress的服务器(有自己的.htaceess),我必须得到project目录。 wordpress的.htaccess写如下,但我无权编辑它。

SetEnv PHP_VER 5_TEST
# BEGIN WordPress
<IfModule mod_rewrite.c>

RewriteEngine On

RewriteBase /

RewriteRule ^index\.php$ - [L]

RewriteCond %{QUERY_STRING} !lp-variation-id

RewriteRule ^go/([^/]*)? /wp-content/plugins/landing-pages/modules/module.redirect-ab-testing.php?permalink_name=$1  [QSA,L]

RewriteRule ^landing-page=([^/]*)? /wp-content/plugins/landing-pages/modules/module.redirect-ab-testing.php?permalink_name=$1 [QSA,L]

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule . /index.php [L]

</IfModule>

# END WordPress

如何强制从我的.htaccess

重定向到我的项目的索引

1 个答案:

答案 0 :(得分:0)

/project/.htaccess

中试用此代码
DirectoryIndex index.php
RewriteEngine On
RewriteBase /project/

# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ index.php/$1 [L]