Reputation: 183
With this. .htaccess code, the domain is forwarded to port 8000. The problem is the port number in the URL.
RewriteEngine On
RewriteCond %{HTTP_HOST} ^my\.subdomain\.com$ [NC]
RewriteRule ^(.*)$ http://my.subdomain.com:8000/$1 [R=301]
I am now looking for a way to forward the domain and remove the port number from the URL. There must be a solution with PHP or. .htaccess be. Web server and all of my domains are running on port 80 and on port number 8000 is running an application.
Edit and modify the httpd.conf file does not work. It is Overridden again. :-( My Hoster confirmed me that
Thank you!
Upvotes: 0
Views: 3154
Reputation: 186
Proxypass imperatives are available in Apache as well as ngnix. I recently answered a different question with the same solution to your problem here: https://serverfault.com/q/448733/261031 and on my own website here: http://joshwieder.blogspot.com/2014/12/apache-virtualhost-proxy-config-nodejs-tomcat.html but I will also reproduce the example here with the port numbers you have specified:
<VirtualHost *:80>
ServerName my.subdomain.com
ProxyRequests Off
ProxyPreserveHost On
<Proxy *>
AddDefaultCharset Off
Order deny,allow
Allow from all
</Proxy>
ProxyPass / http://my.subdomain.com:8000/
ProxyPassReverse / http://my.subdomain.com:8000/
</VirtualHost>
Note that with this configuration you will be able to access your site both with and without port number 8000 as a suffix.
Upvotes: 1
Reputation:
Try Nginx server its quit easy!
bellow is its demo config.
server {
listen 80;
server_name blog.ramki.com;
rewrite_log on;
error_log logs/error_ramki.log notice;
rewrite ^/(.*)$ /department1/$1;
location / {
proxy_pass http://127.0.0.1:8282;
}
}
for further reference please visit This
Upvotes: 0