Home > apache 2.2 > Apache virtual host issue with modrewrite and css files

Apache virtual host issue with modrewrite and css files

April 23Hits:2
Advertisement

I have an Apache virtual host for a project I have done using Silex which is based on Symfony2 however the routing works fine with the modrewrite rules but all calls to javascript or css seem to turn into routes to a controller. Could you help me with the virtual host please.

Options -MultiViews RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^ /index.php [L] DocumentRoot /var/www/html/site/www 

Answers

%{REQUEST_FILENAME} is relative the the DocumentRoot. The above works within a <Directory...> block (or .htaccess file). Try changing it to:

RewriteEngine On
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-f
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-d
RewriteRule .* /index.php [L]

Related Articles

  • Apache virtual host issue with modrewrite and css filesApril 23

    I have an Apache virtual host for a project I have done using Silex which is based on Symfony2 however the routing works fine with the modrewrite rules but all calls to javascript or css seem to turn into routes to a controller. Could you help me wit

  • Grunt CSS min - Issue with minifying different CSS filesJanuary 28

    I'm having issue with minifying multiple CSS files using grunt cssmin I'm not looking to minify all files into single file. I would like to have the files having same name with min.css extension. My gruntfile.js is as follows. module.exports = functi

  • Apache Virtual Host IssueMay 29

    I think I hate Apache now, but on with the issue. It might be a configuration error on my end or just my inability to see what's right in front of me, but I'm trying to configure a sub-domain in Apache and no matter what, it always redirects the sub-

  • apache virtual hosts issue on windows - please explainMay 29

    This problem has never occurred in the past (i have tried this many times) but this time, ALL virtual hosts defined in the virtual-hosts.conf file in the apache installation directory direct the browser to the apache server documentRoot directory. I

  • No mod_expires or mod_headers in apache, how can I cache images/js/css files?September 24

    Title says it all, we do not have control over our server environment and although we can request for them to recompile apache for us it will not happen overnight. Is there anything we can do is these modules (mod_expires, mod_headers) are not availa

  • Drupal 7 cache page for anonymous users causes issues when loading different css files based on browser versionMarch 11

    If you have "cache page for anonymous users" on and are using server logic(http_user_agent) to load different css based on the browser version, that logic will not fire and you will get the css that was cached from the last visitor. This seems a

  • Apache Virtual Host (CSS & Javascript not being found) December 21

    This question already has an answer here: Redirect, Change URLs or Redirect HTTP to HTTPS in Apache - Everything You Ever Wanted to Know About Mod_Rewrite Rules but Were Afraid to Ask 5 answers I am using a LAMP on Oracle Virtualbox. Everything was w

  • Virtual servers not serving .css files properly, issuing 302 response and forwarding to 404 error pageApril 11

    I've got 3 virtualhost directives, and they each host .php and .html files without any problem. However, 2 of them don't seem to be serving .css files correctly. When I check the header response I get this message: HTTP/1.1 302 Found Date: Mon, 11 Ap

  • Apache and Memory issuesJuly 29

    I run a little startup on a Cloud server with 512MB and monitor the CPU/memory consumption with htop and phpsysinfo. Once, the server has ran out of RAM and on some instance get as high as consuming close to 90% of RAM. htop shows apache (httpd) as t

  • Configuring SharePoint 2007 with Apache Reverse Proxy - issues with relative URLsFebruary 16

    This question was posted at ServerFault before I realized there was a community dedicated to SharePoint here. Essentially, we've been tasked with placing our entire SharePoint 2007 app behind an Apache reverse proxy, which maps it to a URL with a sub

  • Creating an Apache Virtual Directory, but updating Active Directory DNSFebruary 16

    I'm just getting started with using the Zend Framework and am following a recommended procedure where I am supposed to create an Apache Virtual Directory for the public-facing portion of a new Zend project. I don't THINK I had any issues creating the

  • How to configure local apache virtual hosts?January 17

    Configuring Apache for local development on Lion I've managed to clue out this much: /private/etc/apache2/ and /etc/apache2/ are symlinked /etc/apache2/httpd.conf is authoritative httpd.conf draws on the confs in extra original is a red herring of un

  • Apache virtual host pointing to wrong document rootSeptember 11

    I am running Linux mint and I'm trying to setup up a virtual host with apache. I have added the following file in /etc/apache2/sites-available/ ( it's copied from the 'default' file in that directory) <VirtualHost *:80> ServerAdmin [email protected]

  • PHP doesn't work on Apache virtual hostJuly 31

    I have a virtual private server with Parallels Power Panel on CentOS 6. The default Apache virtual host (accessed using the IP) works wihtout any problem. Now I created a new domain with Plesk and copied the files in the virtual host directory. Unfor

  • How to Access Apache Virtual Host from Cell Phone?June 10

    I'm developing a mobile web application using Django. Currently I can start the Django development server like this: python ./manage.py runserver <my-ip>:8000 When I do that, I'll get a popup window on my Mac that says, Do you want the application &

  • Apache returning incorrect bootstrap.min.css fileApril 21

    Running Apache 2.2 on CentOS 7 I have a bootstrap.min.css file: /css/bootstrap.min.css It is version 2.2.1. However, when I go to http://example.com/css/bootstrap.min.css, I get a bootstrap file with version 3.1.1. I've verified: The file in the /css

  • Ubuntu Apache Virtual Hosts directing to wrong directory?June 3

    I am running an Ubuntu 14.04 LTS server with Apache installed. I have 3 Virtual Hosts set up, with another Default Server to catch all other requests not taken care of. The Default Server has a Document Root of /var/www/. The other 3 Virtual Hosts ha

  • How to Test Multiple Websites on One PC With Apache Virtual Hosts

    How to Test Multiple Websites on One PC With Apache Virtual HostsApril 23

    It is rare to find a web developer with responsibility for just one website. In this article, we will configure your development PC so you can test any number of websites using a dedicated domain name for each one. You will require a local installati

  • How to log bandwidth usage for Apache virtual hosts?December 21

    I need a way to extract bandwidth usage logs for Apache virtual hosts. I see that a lot of people are recommending AWStats (and similar programs), but I don't need a graphical interface. All I need is usage data formatted in way that can be accessed

  • Apache Virtual Host and CA Intermediate FileNovember 19

    Listed below is an example from an Apache virtual host file. I was curious if there was a particular order that the SSLCertificate, SSLCertificateKeyFile, and the SSLCACertificateFile should be in? Should the intermediate certificate file from the CA

Copyright (C) 2017 ceus-now.com, All Rights Reserved. webmaster#ceus-now.com 14 q. 1.630 s.