0

I have searched a lot but none of the answers I found did the trick. Basically I have a domain (example.com) but my website is in a subvolder(v4)

I have done it so that when people type in www.example.de they get redirected to www.example.de/v4/ which is what I wanted, but my client doesn't want people to see the /v4/ part in the URL.

I have two .htaccess files, the one in the root is:

RewriteEngine on
RewriteRule ^$ /v4/
RewriteCond %{HTTP_HOST} ^(www.)?example.de$
RewriteCond %{REQUEST_URI} !^/v4/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /v4/$1 
RewriteCond %{HTTP_HOST} ^(www.)?example.de$
RewriteRule ^(/)?$ /v4/index.php [L]

The one in the /v4 subfolder is:

RewriteBase /v4/
RewriteRule ^v4/(.+)$ $1 [L,NC,R]
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /v4/index.php [L]
RewriteRule ^v4/(.+)$ $1 [L,NC,R]

I would really appreciate any help in making the /v4/ in the URL invisible, thanks in advance

1
  • 1
    Is that your entire .htaccess file? Commented Jul 20, 2015 at 15:40

1 Answer 1

1

You can have these .htaccess like this:

RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ v4/$1 [L]

The one in the /v4 subfolder should be:

DirectoryIndex index.php
RewriteEngine On
RewriteBase /v4/

RewriteRule ^index\.php$ - [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L]
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.