Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6728847
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T10:13:07+00:00 2026-05-26T10:13:07+00:00

Morning, I have been working on this problem for a few days and cannot

  • 0

Morning, I have been working on this problem for a few days and cannot resolve it.

Http Stack: nginx 1.0.4, apache 2.2.3, symfony 1.4.11

In my web directory I have a symlink to my backend controller, so I can use urls without the .php extension, for example: mysite.com/be_dev.php = mysite.com/be_dev

After some googling I noticed there are a myriad of ways to do it, but the approach I found to be the most elegant was to use the apache with ForceType directives. Without this directive in place, when I use the symlink in the url it simply displays the php code, but when I put the ForceType directives in place it parses the php as expected.

The one problem I am having now, is that when I go through the symlink it treats the symlink as the webroot. So file are being served from /be_dev/sf/sf_web_debug/images/* vs /sf/sf_web_debug/images/*. If I go through be_dev.php then everything works as expected.

I have tried various rewrite rules to remove the /be_dev from the path so it would be served from / as mentioned above, but can’t nail it down.

I am posting relevant snippets of the config files.

Thanks in advance.

/usr/local/nginx/etc/nginx.conf

...
server {
     ...
     location /sf/ {
         root /home/websrc/projects/app/app1/current/framework/data/web;
     }
     ...
}
...

/etc/httpd/conf/vhost.d/10_symfony.conf

<FilesMatch "^(fe|be)?(_dev)?$">
    ForceType application/x-httpd-php
</FilesMatch>

/etc/httpd/conf/vhost.d/999_default.conf

Listen 3001
NameVirtualHost localhost:3001

<VirtualHost localhost:3001>

    SetEnv SERVICECLASS dev
    SetEnv SERVICEAPP   app1

    ServerName     myhost.*.mydomain.lan
    ServerAlias    myhost.*.mydomain.com    

    ServerAdmin systems@mydomain.com

    VirtualDocumentRoot /home/%2/projects/app/app1/current/code/web

    <Directory "/home/*/projects/app/app1/current/code/web">
        AllowOverride none
        Options FollowSymLinks

        RewriteEngine on
        RewriteOptions inherit

        #RewriteCond %{REQUEST_URI} ^/be_dev/.* [NC]
        #RewriteRule ^/be_dev/(.*) /$1 [L,NC,PT]
        #RewriteRule be_dev$ /$1 [L]        

        ######
        # Symfony rules
        ######

        # uncomment the following line, if you are having trouble
        # getting no_script_name to work
        #RewriteBase /

        # we skip all files with .something
        RewriteCond %{REQUEST_URI} \..+$
        RewriteCond %{REQUEST_URI} !\.html$
        RewriteRule .* - [L]

        # we check if the .html version is here (caching)
        RewriteRule ^$ index.html [QSA]
        RewriteRule ^([^.]+)$ $1.html [QSA]
        RewriteCond %{REQUEST_FILENAME} !-f

        # no, so we redirect to our front web controller
        RewriteRule ^(.*)$ index.php [QSA,L]

        RewriteRule /^(be_dev)$ /$1.php [L]
        ######
    </Directory>

    LogLevel debug
    CustomLog /var/log/httpd/app1.dev.access.log combined
    ErrorLog /var/log/httpd/app1.dev.error.log
    RewriteLog /var/log/httpd/app1.dev.rewrite.log
    RewriteLogLevel 9

</VirtualHost>

Update @ 6.13.2011
Still no luck in figuring this one out, any help is appreciated.

Update @ 6.15.2011
Finally got it! Posted on my blog @ http://melikedev.com/2011/06/15/symfony-remove-php-from-controller-using-symlink/

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T10:13:08+00:00Added an answer on May 26, 2026 at 10:13 am

    Finally found out the reason why I couldn’t remove the .php from controller, after some digging around I found that I had to override a ‘request’ setting in the /apps//config/factories.yml file. The full answer can be found on my blog @ http://melikedev.com/2011/06/15/symfony-remove-php-from-controller-using-symlink/, the short answer is given below.

    # /path/to/symfony/apps/<app>/config/factories.yml
    
    # If you don't already have the following activated you will need to make sure it's active under the 'all' directive
    
    all:
    
    ...
    
    request:
      class: sfWebRequest # if you are using custom class be sure to replace this with your custom class name
      param:
        logging:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; %SF_LOGGING_ENABLED%
        path_info_array:&nbsp;&nbsp; SERVER
        path_info_key:&nbsp;&nbsp;&nbsp;&nbsp; PATH_INFO
        relative_url_root: "" # <---This is what I needed to add
    
    ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been puzzling over a problem this morning with LinqToSQL. I'll try and
Been banging my head against this problem all morning. I have setup a connection
I've been working at this all morning hopefully someone can see the problem, I've
I have been scratching my head all morning behind this but still haven't been
I've been working at this all morning and I still can't find a way
I have been attempting this all morning (VS2K10, OL2K7, .NET 3.5) and my PSTs
Quick question. I have been Googling this all morning, but it's either not there,
I have been dabbling around this morning trying to modify the jQuery cycle script
I have been looking at the webmaster tools this morning, and I have quite
So I have been struggling with this one all morning. I have read a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.