react-router browserHistory doesn’t work on Apache server

I have an HTML single page app that I'm trying to get working with react router's browserHistory, but with no success. Everything works fine on local dev server and also in prod when using hashHistory.

Things I have tried from everything I've read so far:

  • .htaccess update from the official docs (this doesn't seem to do anything). Can anyone confirm that this works?
  • createBrowserHistory (with and without webpack plugin)

Is that a known limitation for Apache servers? Any help will be much appreciated.

vbulletin forum within Silverstripe Root – url misdirection – htaccess?

We have a vBulletin 5 installation within a Silverstripe root, loaded into a folder called 'Community'. The url to the community's index file should therefore be: www.e-lumini.com/community. However, the url is automatically appended with ./?url=/community [appearing fully as http://e-lumini.com/community/?] and, of course, redirects to a 404 page.

Presumably, this is an .htaccess content issue.

Anyone an idea on how to deal with this incorrect url redirect issue?

+++++++ Current Silverstripe .htaccess content ++++++++++

Many thanks in advance -

Raymond Den Otter

Redirect if an "x" file exists in the same directory

I don't seem to figure out a way to extract the directory (without file) for a RewriteCond.

Basically, if a user accesses any URL of this format,

https://example.com/00/01/05/23/11/file.jpg

And I want a RewriteCond that checks if an "x" file exists in the same directory,

https://example.com/00/01/05/23/11/x

And, if so, redirect somewhere else (e.g., return 404).

The .htaccess file is in the root directory and this has to work for any path.
There must be an easy way to do this, but I don't find any environment variable that contains just the directory???

Thank you.

Convert all parameterized dynamic URLs to SEO friendly URLs in PHP

I am asking question after so many attempts to do this. Found many results on this website but none of them worked for me.

I have a website built in PHP (no any CMS) that has URLS like

www.someweb.com/job_detail?job_id=this-is-my-job-no-1

www.someweb.com/job_detail?job_id=this-is-my-job-no-2

www.someweb.com/job_detail?job_id=this-is-my-job-no-3

I just want to convert all URLS like these

www.someweb.com/job_detail/this-is-my-job-no-1

www.someweb.com/job_detail/this-is-my-job-no-2

www.someweb.com/job_detail/this-is-my-job-no-3

Here is my .htaccess content:

DirectoryIndex index.php
RedirectMatch 404 ^/admin/$
RedirectMatch 404 ^/admin/uploads/$
ErrorDocument 404 /page_not_found.php
<Files index.php>
    Order deny,allow
    deny from all
    allow from all
</Files>

Have tried many ways but no one solved my issue. Please help me getting fine solution. Thanks.

How to redirect a domain to a subdomain and keep URL using .htaccess?

There used to be a Wordpress running under wp.mydomain.com and a static presentation running under mydomain.com on my webhosting.

Now I want to change the satatic presentation to a Wordpress static page (eg. wp.mydomain.com/static-page) - when user enters mydomain.com, wp.mydomain.com/static-page should display, however the URL shouldn't change.

Currently I use in my .htaccess:

RewriteRule ^$ http://wp.mydomain.com/static-page

however it changes the URL. Is there a way to show static-page and keep the URL mydomain.com using .htacces?

Configuring Apache in front of Jboss as load balancer

I have my web application deployed in JBoss AS 7.1. After writing middleware code in Java, when I started writing user interface. I thought of using Apache httpd for accessing static resources like css, js and html. Hence I installed httpd 2.4.23 and made configuration changes to access the directory in which I have my static resources. Then I wanted to use httpd as load balancer. For that I installed mod_jk 1.2.41. I created workers.property with following details:

# for mapping requests 
# The configuration directives are valid 
# for the mod_jk version 1.2.18 and later 
worker.list=loadbalancer,status 
# Define node 
# modify the host as your host IP or DNS name. 
worker.node.port=8009
worker.node.host=127.0.0.1 
#(IP or DNS name of the server on which Jboss is running) 
worker.node.type=ajp13 
worker.node.lbfactor=1 
# Load-balancing behaviour 
worker.loadbalancer.type=lb 
worker.loadbalancer.balance_workers=node 
worker.loadbalancer.sticky_session=1 
worker.status.type=status

Here is my mod-jk.conf

LoadModule jk_module modules/mod_jk.so
JkWorkersFile conf/workers.properties
JkShmFile logs/mod_jk.shm
JkLogFile logs/mod_jk.log
JkLogLevel info
JkMount /sb/* loadbalancer
JkMount /sb.web/* loadbalancer

I added this configuration file at the end of httpd.conf:

Include C:/Apache24/conf/mod-jk.conf

I checked my JBoss configuration refering following:

https://docs.jboss.org/author/display/AS71/Using+mod_jk+with+JBoss+AS7#Usingmod_jkwithJBossAS7-Compile%26InstallApacheHttpd

I am not able to acccess my JBoss application using httpd URL. It gives following error:

::1 - - [01/Aug/2016:01:26:58 +0530] "GET /sb/v1/sc/m/2/ HTTP/1.1" 503 299

I am able to access JBoss application by its own URL and can access static content using httpd URL means both of these servers are running perfectly. Please help.

htaccess redirect ending with number and a letter

Some of my website urls are ending with a 10 digit number and a letter "M" in it. I want to redirect it to my homepage. I am using apache web server.

The url www.example.com/my-page/M1234567890 should redirect to www.example.com

I was trying to achieve this using redirectmatch in .htaccess, but the pattern which i have given in .htaccess is not working. I tried to achieve this in many ways, but not working.

Please see my below code.

Redirectmatch 301 ^([C])(d{14})/?$ /

HTTP KeepAlive connection closed by server but client had sent a request in the mean time

The scenario is as below:

  • There is an http reverse proxy, that has a pool of persistent connections with the application server. It has received a request from client and makes the same request to backend after checking that the connection is open
  • Meanwhile, the server closes the connection before receiving the request, and the proxy fails with error reading from backend.
  • An error is sent to the client.

How should this race condition be handled: - All connection close should be initiated by proxy and never by the backend server? - Proxy should retry request when it fails to send because of connection close?