0

I have a web application in http://example.com:8080/example-app/

When the user types http://example.com/ , I'd like to redirect him to the web app.

Options +FollowSymLinks
RewriteEngine On
RewriteCond   %{HTTP_HOST}   (.*)example.com$         [NC]
RewriteRule ^(.*)$ http://example.com:8080/example-app/$1 [L,R=301]

I believe the .htaccess has the correct access right:

$ ls -altr /var/www/html/.htaccess
-rw-r--r-- 1 apache apache 178 Jul  2 00:31 /var/www/html/.htaccess

But navigating to http://example.com/ just serves the index.html file.

Can someone tell me why this doesn't work? I there a way to debug this? (apache on centos).

1
  • I had a problem with apache configuration. Thank you. Commented Jul 3, 2015 at 23:06

1 Answer 1

1

change the server default listening port from 8080 to 80 in configuration file this one is easy or try the proxy tho redirect the request as below and the default Document Root folder

     NameVirtualHost *:8080

    <VirtualHost *>
     ServerAdmin [email protected]
     ServerName www.example.com:8080
     ProxyPreserveHost On

  # setup the proxy
    <Proxy *>
       Order allow,deny
       Allow from all
       </Proxy>
     ProxyPass / http://www.example.com:80/
     ProxyPassReverse / http://www.example.com:80/
   </VirtualHost>
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.