Apache Web Server

19K

Solutions

12

Articles & Videos

14K

Contributors

The Apache HTTP Server is a secure, efficient and extensible server that provides HTTP services in sync with the current HTTP standards. Typically Apache is run on a Unix-like operating system, but it is available for a wide variety of operating systems, including Linux, Novell NetWare, Mac OS-X and Windows. Released under the Apache License, Apache is open-source software.

Share tech news, updates, or what's on your mind.

Sign up to Post

I need to write a rule in my apache htaccess file to redirect:

/insurance-plans/year/schools/international-student-plans-2015?s=136&l=5000
to:
http://%{SERVER_NAME}/insurance-plans/year/schools/international-student-plans-2017?s=136&l=7000

The rule I wrote is as follows, but it does nothing:

RewriteRule ^insurance-plans\/year\/schools\/international-student-plans-2015?s=136&l=5000$		http://%{SERVER_NAME}/insurance-plans/year/schools/international-student-plans-2017?s=136&l=7000	[R=301,L,NC,NE]

Open in new window


I'd be grateful if someone would show me the correct htaccess code to implement my redirect.

Thanks,
Jon
0
Enroll in June's Course of the Month
LVL 9
Enroll in June's Course of the Month

June’s Course of the Month is now available! Experts Exchange’s Premium Members, Team Accounts, and Qualified Experts have access to a complimentary course each month as part of their membership—an extra way to sharpen your skills and increase training.

Hello Experts,

What's wrong with this code: ??  ( in httpd.conf )

RewriteEngine on
RewriteCond %{REMOTE_ADDR} !="[1-50]\.[0-255]\.[0-255]\.[0-255]"
RewriteRule /scripts/(.*) http://localhost:81/scripts/$1 [P,L]
RewriteRule /game/(.*) http://localhost:81/game/$1 [P,L]

RewriteCond %{REMOTE_ADDR} !="[51-99]\.[0-255]\.[0-255]\.[0-255]"
RewriteRule /scripts/(.*) http://localhost:82/scripts/$1 [P,L]
RewriteRule /game/(.*) http://localhost:82/game/$1 [P,L]

RewriteCond %{REMOTE_ADDR} !="[100-150]\.[0-255]\.[0-255]\.[0-255]"
RewriteRule /scripts/(.*) http://localhost:83/scripts/$1 [P,L]
RewriteRule /game/(.*) http://localhost:83/game/$1 [P,L]

RewriteCond %{REMOTE_ADDR} !="[151-200]\.[0-255]\.[0-255]\.[0-255]"
RewriteRule /scripts/(.*) http://localhost:84/scripts/$1 [P,L]
RewriteRule /game/(.*) http://localhost:84/game/$1 [P,L]

RewriteCond %{REMOTE_ADDR} !="[201-255]\.[0-255]\.[0-255]\.[0-255]"
RewriteRule /scripts/(.*) http://localhost:85/scripts/$1 [P,L]
RewriteRule /game/(.*) http://localhost:85/game/$1 [P,L]

RewriteCond %{REMOTE_ADDR} ="192\.168\.1\.[1-255]"
RewriteRule /scripts/(.*) http://localhost:86/scripts/$1 [P,L]
RewriteRule /game/(.*) http://localhost:86/game/$1 [P,L]

Open in new window


------------

Looks like only one instance of my webservice is doing all the heavy work, while the others don't.
The webservices are pre-set to listen to ports 81-88, but looks like the port 81 guy doing all the work.


webservices and their RAM usage...

What I am trying to do is spread the workload to the different web-services listening to the ports, correctly so a better balance-loading is achieved.

I run apache 2.2.16 (win 32) with php 5.3.3.

Any ideas?
0
Hi Guys,

I am having an issue with my server where my server is running really slow, i can see the load avg is pretty high, there is only one site running on it

(http://iradio.ie)

I have attached the error log and the only issue , is where it says empty input file for http://iradio.ie/newPlayer (which does actually exist)

i have changed DNS over the last 24 hours
0
I want to put a mod_rewrite rule in httpd.conf to handle mobile requests. If the browser on the sending device accepts mobile stuff, I want to rewrite the request to the original file name with an "m_" in front. So if a mobile device sends

https://example.com/51/a1.html
I want to rewrite it to

 https://example.com/51/m_a1.html
I have the lines below now in httpd.conf:

RewriteCond %{HTTP_ACCEPT} "text\/vnd\.wap\.wml|application\/vnd\.wap\.xhtml\+xml" [NC]

RewriteRule ^example.com/([0-9]*)/(.*)$ ^example.com/$1/m_$2
But requests from a mobile device don't get rewritten. Does anyone see the problem?

Thanks
0
Our production website is using SOLR Search.   I am in the process of standing up a dev/test and staging environment.  Each needs to have it's own instance of SOLR.   My question is this.   How can I see what server SOLR is indexing?   I want to ensure that the dev/test and staging instances of SOLR don't attempt to reference the production VM.
0
Hello
I need htaccess code to make permalinks and redirect them on a single file
like i need example.com/a
example.com/b
example.com/c
example.com/anything
these urls to show my index file
0
I see a lot of this, but nothing seems to be helping. I have a server configured with Apache + nginx running together. I have many WordPress sites and Vanilla 2.1.10 running just fine with pretty URLs via htaccess rewriting.

I'm trying to updated to Vanilla 2.3, but when I upload all the new files I end up with 404s. The README mentions that "Additional setup is required on nginx and other platforms" but it doesn't go into detail.

In the forum and other places, I see people talking about how to fix this, and this link seems to provide the simplest method, which is basically to add this to the nginx vhost:

 location /forum
 {
 try_files $uri $uri/ @forum;
 }
 location @forum
 {
 rewrite ^/forum(.+)$ /forum/index.php?p=$1 last;
 }

Open in new window


Our forum is indeed located at /forum on our site, and we tried this code but it's not fixing the problem.  Any information on how I can get this fixed would be greatly appreciated. Thanks!
0
I am having little difficulty in resolving one URL redirection in remote location. Example: My website is https://temp.company.local/dev/rel and it's accessible through Remote host. However, when user requests for https://temp.company.local, he is getting redirected to Apache manager page which I don't want. Can you please provide a solution to fix this problem so that only proper URL will work and half will not redirect to tomcat manager page?
Just to update I'm not using IIS.

Best Regards,
Abhi
0
Dear experts,
We have a HAProxy installation with SSL-Passthrough (we need the SSL to reach the apache itself for proper HTTP/2 handling so we can't use SSL termination on HAProxy)

However, I can't seem to configure the HAPrxoy to send the real IP to Apache, the logs always show the internal IP of the HAProxy.

This is my HAProxy Config:

#---------------------------------------------------------------------
# Global settings
#---------------------------------------------------------------------
global
    log         127.0.0.1 local2     #Log configuration
 
    chroot      /var/lib/haproxy
    pidfile     /var/run/haproxy.pid
    maxconn     30000                
    user        haproxy             #Haproxy running under user and group "haproxy"
    group       haproxy
    daemon
 
#---------------------------------------------------------------------
# common defaults that all the 'listen' and 'backend' sections will
# use if not designated in their block
#---------------------------------------------------------------------
defaults
    mode                    http
    log                     global
    option                  httplog
    option                  dontlognull
    option http-server-close
    option forwardfor       except 127.0.0.0/8
    option                  redispatch
    retries                 3
    timeout http-request    10s
    timeout queue           1m
    timeout connect         10s
    timeout client          1m
    timeout 

Open in new window

0
Here is what I have but... it's not masking the URL.  

RewriteEngine on
RewriteCond %{HTTP_HOST} ^subdomain\.domainA\.net$ [OR]
RewriteCond %{HTTP_HOST} ^www\.subdomain\.domainB\.net$
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule ^/?$ "http\:\/\/subdomain\.domainB\.net" [R=301,L]
0
Industry Leaders: We Want Your Opinion!
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

HTTP Status 404 - /example/myapp/list

type Status report

message /example/myapp/list

description The requested resource is not available.

Apache Tomcat/7.0.69
0
C:\windows\system32>c:\Apache24\bin\httpd -S
httpd: Syntax error on line 532 of C:/Apache24/conf/httpd.conf: LoadModule takes two arguments, a module name and the name of a shared object file to load it from
0
Hi,
When I try to restore a db backup (40Mb zipped), It takes around 5 mins to upload and  then around 2 mins later I got this error

Internal Server Error 500 The cPanel Server operation timed out at cpsrvd.pl line 541.

I changed

max_execution_time=9000
cPanel PHP max execution time=9000

but it did not help. Any ideas?
Thank you.
0
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:sunrpc          0.0.0.0:*               LISTEN      1/systemd
tcp        0      0 0.0.0.0:8817            0.0.0.0:*               LISTEN      5308/mongod
tcp        0      0 0.0.0.0:ssh             0.0.0.0:*               LISTEN      652/sshd
tcp        0      0 localhost:smtp          0.0.0.0:*               LISTEN      907/master
tcp        0      0 localhost:32000         0.0.0.0:*               LISTEN      2418/java
tcp        0      0 localhost:27017         0.0.0.0:*               LISTEN      1797/mongod
tcp6       0      0 [::]:monkeycom          [::]:*                  LISTEN      2418/java
tcp6       0      0 [::]:sunrpc             [::]:*                  LISTEN      1/systemd
tcp6       0      0 [::]:webcache           [::]:*                  LISTEN      3387/java
tcp6       0      0 [::]:http               [::]:*                  LISTEN      4534/httpd
tcp6       0      0 [::]:ssh                [::]:*                  LISTEN      652/sshd
tcp6       0      0 [::]:ddi-tcp-1          [::]:*                  LISTEN      28290/node
tcp6       0      0 localhost:smtp          [::]:*                  LISTEN      907/master
tcp6       0      0 [::]:https              [::]:*                  LISTEN      4534/httpd
tcp6       0      0 localhost:mxi           [::]:*                  LISTEN   …
0
hi all,
if I add mod  pagespeed,  mod expire option is not setting up on network tab.

if I remove pagespeed I can see expire for each extensions are showing properly.

how to fix this issue?
0
I was asked to redirect a request coming on port 80 (Apache) to port 8080.

Before I changed anything, localhost:80 would show "It works" and locahost:8080 the Apache welcome page.

I did the following changes :

- uncommented LoadModule proxy_module modules/mod_proxy.so & LoadModule proxy_http_module modules/mod_proxy_http.so from the httpd.conf file
- uncommented Include conf/extra/httpd-vhosts.conf, always in httpd.conf

In httpd-vhosts.conf, I added :

<VirtualHost *:80>
    ServerName mydomain
    ProxyRequests Off
    ProxyPreserveHost On
    ProxyPass /  http://mydomain:8080/webApp
    ProxyPassReverse / http://mydomain:8080/webApp
</VirtualHost>

Open in new window


But when I try http://localhost, I do arrive on my webApp, but all css styling, images, ... are missing :

Screen-Shot-063.JPG
I have an idea why it is not working : when I inspect my page, and look at the header i see that the link to the favicon for example is http://mydomain/webApp/images/favicon.ico, but if I copy paste that link, I will of course not find the favicon because it is not on Apache, but Tomcat (if that makes any sense). If I add the port to the URL, then it works : http://mydomain:8080/webApp/images/favicon.ico

Has this anything to do with the problem stated here : https://serverfault.com/questions/561892/how-to-handle-relative-urls-correctly-with-a-reverse-proxy ?

This is because the tomcat response headers will contain the proxy headers (i.e. the Location header is http://mydomain/WebApp rather than http://mydomain:8080/WebApp) because ProxyPreserveHost is switched On

So I switched it to Off :


Open in new window

0
I am attempting to load new SSL certs into my Tomcat Server. I was successful in creating a new KeyStore and CSR. before I import the certs I was able to browse to my site internally via the correct port. However, after successfully importing the certs in the Keystore I am unable to browse to the site. I am new to Tomcat and would appreciate any assistance.

Thanks.
2017-05-23--1-.png
2017-05-23.png
0
I do NOT want my users redirected to mobile.htm, but just left alone regardless of browser.  On a smart phone even when they type out index.htm, they still get redirected to a broken link.  I am on tomcat nix server.
1
Hi expert,
 I have 2 critical requirement if user hits anything  after domain needs to go to below URL.

1.example:
www.rwar.com/alpha needs to go as

/content/xyz/test.html

2.if user types or click the below URL the page needs to go to same page

/content/abc/cokie.html
0
Independent Software Vendors: We Want Your Opinion
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

I have a server which runs on PostgreSQL, Django on apache and gets hang up every couple of days. I understood that it would require PostgreSQL optimization. But there are so many parameters not sure where to start. As of now, the server hanging up. Please let me know what kind of information you need so that I can provide you and you can better assist me.

Also I have iptables firewall setup not sure where exactly is the problem. But the website hangs up every 1 one day and when I restart the apache it works for one day.
0
I have setup an Apache web-server to request client certificates and I need to revoke some of the client certificates. Removing them from the client machine is not an option so I need to revoke them from the server so it does not see them as valid.

I'm trying to use the command :

openssl ca -revoke /etc/ssl/certs/client123.pem

where client123.pem was a certificate validated by the web-server (where the ca was configured).

Thanks
0
Dear EE,
I am a developer who has worked with various BI tools including Cognos.
I am given teh task of installation of Cognos on Unix  Using  Apache Web Server and the same box to also act as the Application server.
Also, there is Signgle Sign On using LDAP. How to integrate that with the Cognos Connection?

Please let me know, what are the steps and vonfigurations which need to be kept in Mind. Also if there is any good resource where I can look for a  generic step by step instructions ?
0
Users: -------Login to server --- Gets a URL:  65.X.X.X/192.168.1.x
When the click on the url they should get to the Devices with IP 192.168.1.X and it asks them to login. When they login it should still continue to prefix the proxy address but it doesn't. What could be the issue for this?

default.conf file:
<VirtualHost *:*>
 <Proxy *>
  Order deny,allow
  Allow from all
 </Proxy>

 ProxyPreserveHost On 
 ProxyRequests Off
 ProxyPass / http://ip_to_backend_server/
 ProxyPassReverse / http://ip_to_backend_server/
 ProxyHTMLEnable On
 ProxyHTMLExtended On
 SetOutputFilter INFLATE;proxy-html;DEFLATE;

 <LocationMatch ^/(192\.168\.1\.[0-9]+)?(/.*)?$>
   ProxyPass http://$1
   ProxyPassReverse http://$1
 </LocationMatch>
 
</VirtualHost>

Open in new window


We would like to hire an engineer who can help us solve this problem.
0
I have the following custom permalink structure in wordpress
/job/%postname%/

Open in new window


I installed a popular Custom Post plugin (Custom Post Type UI), and called the Custom post My Story, with a slug of my-story.  

I've got the "Custom ReWrite Slug" to True, and my-story,  but the url always outputs as http://mydomain.com/job/my-story/pagename

I've tried messing around in the .htaccess file with

<IfModule mod_rewrite.c>
RewriteEngine On

RewriteRule ^my-story/?$ job/my-story/ [NC,L]
</IfModule>

Open in new window


But still will not get rid of the /job/.  

Any ideas how i can modify the code above, to strip /job/ from the http://mydomain.com/job/my-story/pagename . only for this custom post type.
0
Hi guys,
I have one image where it is coming from rendition image with more than 3 dots.
example:
image/test.img.small.img/gokul.png

due to this,  images  not loading in site and showing broken image.

if I add as below,  above issue is resolving and image with single extension is not working.

filematch  .png
sethandler. png

so how to handle both request properly.

I hope filematch needs to have location match and allow only path which have multiple extension.
0

Apache Web Server

19K

Solutions

12

Articles & Videos

14K

Contributors

The Apache HTTP Server is a secure, efficient and extensible server that provides HTTP services in sync with the current HTTP standards. Typically Apache is run on a Unix-like operating system, but it is available for a wide variety of operating systems, including Linux, Novell NetWare, Mac OS-X and Windows. Released under the Apache License, Apache is open-source software.