Regwy
Regwy

Reputation: 121

Redirect root index.php to subdirectory

I've installed wordpress into a folder and I would like to redirect root index.php to wordpress the folder without using

header('Location: ./folder/');

or meta redirect. I would like to redirect only index file with something like .htaccess rules. How can I do this?

EDIT

I've expressed myself badly, I need a sort of redirect but not a true redirect because using redirect causes some problems with Google. So I'd like to give ./folder/ instead of index.php or ./.

Upvotes: 0

Views: 1961

Answers (2)

Omer Farooq
Omer Farooq

Reputation: 4054

Your htaccess should look something like this

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

Just replace

RewriteBase /

With

RewriteBase /foldername

Upvotes: 1

Rajnikant Sharma
Rajnikant Sharma

Reputation: 606

use this redirect

Redirect 301 /index.php /sub/index.php

Upvotes: 0

Related Questions