Dom
Dom

Reputation: 3126

Redirecting site to sub-sub folder

I have a website in my public_html folder placed in the following folder structure

public_html/dps/main

I am using .htaccess to redirect in the following format ;

RewriteEngine on

RewriteCond %{HTTP_HOST} ^(www.)?website.co.uk$
RewriteCond %{REQUEST_URI} !^/dps/main/
RewriteCond /domain/%{REQUEST_URI} -d
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteRule ^(.*)$ /dps/main/$1/

RewriteCond %{HTTP_HOST} ^(www.)?website.co.uk$
RewriteCond %{REQUEST_URI} !^/dps/main/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /dps/main/$1

RewriteCond %{HTTP_HOST} ^(www.)?website.co.uk$
RewriteRule ^(/)?$ /dps/main/index.php [L]

Unfortunately it gives me Internal Server Error

not sure what is wrong with this code.

Thank you for your help in advance

Upvotes: 1

Views: 82

Answers (1)

anubhava
anubhava

Reputation: 784918

Replace your rules with this:

DirectoryIndex index.php

Options +FollowSymLinks -MultiViews
RewriteEngine on
RewriteBase /

RewriteCond %{HTTP_HOST} ^(www.)?website\.co\.uk$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^((?!dps/main/).*)$ /dps/main/$1 [L,NC]

Upvotes: 1

Related Questions