1
votes

In my Symfony 3.0.9 project I developed the controller routes under dev. First the routings were in the routing_dev.yml and returned a 404 error under production. Make sense.

  • I have already copied the routes in the routing.yml
  • Cleared the Cache
  • Warmupped the Cache
  • Restarted Server

But still the server returns 404 error, when i try to open a route without "app_dev.php".

Here are the not working routes:

#### routing.yml
login_route:
    path: /login
    defaults: { _controller: AppBundle:Security:login }

login_check:
    path: /stage/login_check

logout:
    path: /stage/logout

_default:
    path: /
    defaults: { _controller: AppBundle:Default:dashboard }

main:
    path: /stage
    defaults: { _controller: AppBundle:Default:dashboard }

offerUtils:
  path: /stage/api/v2/offer/utils
  defaults: { _controller: AppBundle:Utils/OfferUtils:get }

offerGet:
  path: /stage/api/v2/offer/{offerId}
  defaults: { _controller: AppBundle:OfferBase:get, offerId:false }
  methods: [GET]

offerDelete:
  path: /stage/api/v2/offer/delete/{offerId}
  defaults: { _controller: AppBundle:OfferBase:delete }
  methods: [DELETE]

offerPost:
  path: /stage/api/v2/offer/{offerId}
  defaults: { _controller: AppBundle:OfferBase:post }
  methods: [POST]

merchantsGet:
  path: /stage/api/v2/merchants
  defaults: { _controller: AppBundle:Lead:get }
  methods: [GET]

merchantsPost:
  path: /stage/api/v2/merchants
  defaults: { _controller: AppBundle:Lead:post }
  methods: [POST]

template:
  path: /stage/api/v2/template
  defaults: { _controller: AppBundle:OfferTemplate:get }

updatePricing:
  path: /stage/api/v2/offer/{offerId}/modules/pricing
  defaults: { _controller: AppBundle:Pricing:update }

updateOption:
  path: /stage/api/v2/offer/{offerId}/options/{optionId}
  defaults: { _controller: AppBundle:OfferOption:update }

updateModule:
  path: /stage/api/v2/offer/{offerId}/modules/{moduleId}
  defaults: { _controller: AppBundle:OfferModule:update }

offerIndex:
  path: /stage/templates/offerIndex
  defaults:
    _controller: FrameworkBundle:Template:template
    template: offermanagement/offerIndex.html.twig

offerEdit:
  path: /stage/templates/offerEdit
  defaults:
    _controller: FrameworkBundle:Template:template
    template: offermanagement/offerEdit.html.twig

directive_leadStartingLetterBtnGroup:
  path: /templates/leadStartingLetterBtnGroup
  defaults:
    _controller: FrameworkBundle:Template:template
    template: offermanagement/leadStartingLetterBtnGroup.html.twig

directive_editModulePricingModal:
  path: /templates/editModulePricingModal
  defaults:
    _controller: FrameworkBundle:Template:template
    template: offermanagement/editModulePricingModal.html.twig

directive_editOptionPricingModal:
  path: /templates/editOptionPricingModal
  defaults:
    _controller: FrameworkBundle:Template:template
    template: offermanagement/editOptionPricingModal.html.twig

directive_removeOfferModal:
  path: /templates/removeOfferModal
  defaults:
    _controller: FrameworkBundle:Template:template
    template: offermanagement/removeOfferModal.html.twig

directive_status:
  path: /templates/status
  defaults:
    _controller: FrameworkBundle:Template:template
    template: offermanagement/status.html.twig

The Firewall in security.yml:

firewalls:
    main:
        pattern: ^/stage
        provider: hcs_db_provider
        form_login:
            login_path: /login
            check_path: /stage/login_check
            default_target_path: main
        logout:
            path: /stage/logout
            target: /login
1
Have you PHP cache on server? Restart php-fpm as well.malcolm
the "server" is my local wampp server and i restarted it over the services. Already did the changes yesterday and restarted complete windows.kristof
Do your routes show up when you run php bin/console debug:router --env=prod? Have you tried accessing the routes with {host}/app.php/{path}? i.e. Is it possible that this is a URL rewrite problem?Francois
@Francois When I request /web/app.php/stage Im getting redirected to /web/stage where a 404 is thrown. The routes are listen under php bin/console debug:router --env=prodkristof
@kristof is /web a route prefix? What happens if you remove it from your path? If your document root is set to e.g., /var/www/myProject/web (default Symfony vhost setup as per the docs), the default .htaccess setup will be looking for a web folder in your 'root' web folder (/var/www/myProject/web/web) and then try to serve app.php from there.Francois

1 Answers

0
votes

The problem was the following: in the .htacces file we commented the redirect roule. If you got this problem, check your .htacces in the web/ folder.