Writing .htaccess for redirecting in subfolder

I’ve done this lot’s of times and it always worked.Now it doesn’t.

I have a wp/index.php file in my main public folder on cpanel/server.

Read More

In the .htaccess file I’ve written following.

RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www.dewildequinten.be/wp)(:80)? [NC]
RewriteRule ^(.*) http://dewildequinten.be/wp/$1 [R=301,L]
DirectoryIndex index.php   

This should redirect http://www.dewildequinten.be to http://www.dewildequinten.be/wp/index.php

Pretty straight forward.
Now 2 problems arise.

1 It’s just goes directly to my main folder and shows my directory listing. (And I know how to disable this when it works)

2 When I just type dewildequinten.be it brings me to dewildequinten.be/dewildequinten

I have no direct question except if someone see’s where I have gone wrong with this.

Related posts

1 comment

  1. Ok I found the answer myself for further people having this problem.

    This is wat solved it for me.

    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^(www.)?mysite.be$
    RewriteRule ^(/)?$ folder [L]
    DirectoryIndex index.php
    

    mysite.be => your domainname
    folder => the name of you’re folder you want to redirect to!

Comments are closed.