.htaccess equivalent of baseurl?

Posted by Ryan on Stack Overflow See other posts from Stack Overflow or by Ryan
Published on 2010-04-01T00:47:45Z Indexed on 2010/04/01 0:53 UTC
Read the original article Hit count: 416

Filed under:
|
|

Hello,

I'm trying to install Symfony on a shared server and am attempting to duplicate the httpd.conf command:

# Be sure to only have this line once in your configuration
NameVirtualHost 127.0.0.1:8080

# This is the configuration for your project
Listen 127.0.0.1:8080

<VirtualHost 127.0.0.1:8080>
  DocumentRoot "/home/sfproject/web"
  DirectoryIndex index.php
  <Directory "/home/sfproject/web">
    AllowOverride All
    Allow from All
  </Directory>

  Alias /sf /home/sfproject/lib/vendor/symfony/data/web/sf
  <Directory "/home/sfproject/lib/vendor/symfony/data/web/sf">
    AllowOverride All
    Allow from All
  </Directory>
</VirtualHost>

I need to do so using .htaccess

The redirect portion was done in the root using the following:

Options +FollowSymlinks
RewriteEngine on
rewritecond %{http_host} ^symfony.mysite.ca [nc]
rewriterule ^(.*)$ http://symfony.mysite.ca/web/$1 [r=301,nc] 

For the alias, I've tried using:

RewriteBase /

but no success.

The main issue is that the index.php file residing in the /web folder uses the /web path in its path to images and scripts. So instead of

href="/css/main.css"  //this would work

it uses

href="/web/css/main.css"  //this doesn't work, already in the /web/ directory!

Any ideas? Thanks!

© Stack Overflow or respective owner

Related posts about .htaccess

Related posts about symfony