skip to Main Content

My folder structure is like this: www.testlink.com/angular/dist/my-app.
I have to access this folder when entering this link : www.testlink.com/angular.

How can I do with htaccess?

2

Answers


  1. Its better if you use subdomain

    htaccess configuration

    Options -MultiViews
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.html [QSA,L]
    

    Add base url to index.html

    <base href="http://subdomain.testlink.com/">
    

    Configure apache

    <VirtualHost *:80>
        ServerName www.subdomain.example.com
        ServerAdmin webmaster@localhost
        DocumentRoot /path/of/your/directory
    
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
    </VirtualHost>
    
    Login or Signup to reply.
  2. This probably is what you are looking for, a combination of an external redirection with an internal rewrite:

    RewriteEngine on
    RewriteRule ^/?angular/dist/my-app(/.*) /angular$1 [QSA,R=301,END]
    RewriteRule ^/?angular(/.*) /angular/dist/my-app$1 [QSA,END]
    

    Obviously the rewriting module needs to be enabled inside the http server for that and the interpretation of distributed configuration files (".htaccess") has to be enabled for that location inside the http server.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search