1

In .htaccess code is written as

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]

But this .htaccess is redirecting to index.php of my web root rather than that of the project. I have server which have wordpress installed directly at root (with its own .htaceess) and I have to get the project directory working with that . .htaccess of wordpress is written as below but I dont have access to edit it .

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

How can I force to redirect to index of my project from my .htaccess

alwaysLearn
  • 6,882
  • 7
  • 39
  • 67
  • Well, if you cannot change that `.htaccess` style file, and it si in top level, then you cannot work around it, _except_ if you have access to the real server configuration. Coding such rules there is preferred anyways, since `.htaccess` style files are notoriously error prone, a pain to debug and really slow the server down. I'd say that requests to existing files won't get rewritten, for other requests there is nothing you can do... – arkascha Mar 06 '15 at 08:42
  • What is the full URL you're entering browser and where is first .htaccess located? – anubhava Mar 06 '15 at 08:48
  • `http://example.com/project/myfilename` – alwaysLearn Mar 06 '15 at 08:54

1 Answers1

1

Try this code in /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]
anubhava
  • 761,203
  • 64
  • 569
  • 643