1

I'm newbie in apache, i have the following directory structure:

html
|-- moodle
    |-- singapur
        |-- app
        |-- public
           |-- js
           |-- css
           |-- img
           |-- index.php

I need redirect from www.mywebpage.com/singapur to www.mywebpage.com/singapur/public

the .htaccess located in the folder singapur is:

Options -Indexes
<IfModule mod_rewrite.c>
    Options -Multiviews
    RewriteEngine On
    RewriteBase /singapur/
    RewriteRule .* public/$1 [L]
</IfModule>

the .htaccess located in the folder public is:

<IfModule mod_rewrite.c>
    Options -Multiviews
    RewriteEngine On
    RewriteBase /singapur/public
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]
</IfModule>

The file moodle.conf:

<VirtualHost *:80>
        ServerName webpageexample.cl
        ServerAlias www.webpageexample.cl
        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/html/moodle
        <Directory /var/www/html/moodle/>
             Options Indexes FollowSymlinks MultiViews
             AllowOverride All
             Order allow,deny
             allow from all
             Require all granted
        </Directory>
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

But, when i try access to webpageexample.cl/singapur from web browser, i obtain the following

Forbidden

You don't have permission to access /singapur/ on this server.

in apache log:

Cannot serve directory /var/www/html/moodle/singapur/: No matching DirectoryIndex (index.html,index.cgi,index.pl,index.php,index.xhtml,index.htm) found, and server-generated directory index forbidden by Options directive

Thanks

1 Answer 1

0

You can use the RedirectionMatch directive to foce Apache to send the user someplace else.

RedirectMatch 301 ^(.*)$ http://www.anotherserver.com$1

Click here for more knowledge.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .