Jump to:

4952 Posts in 14221 Topics by 1491 members

Installing SilverStripe

SilverStripe Forums » Installing SilverStripe » Friendly URLs No Longer Working - After Domain Change - (SS 3.0)

Getting SilverStripe up and running on your computer and on your web server.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1 2
Go to End
Author Topic: 1693 Views
  • ocean
    Avatar
    Community Member
    37 Posts

    Friendly URLs No Longer Working - After Domain Change - (SS 3.0) Link to this post

    Hello,

    I had been developing an SS 3.0 site on a remote server using the domain 'dev.somesite.com' pointed to a folder called 'webroot'. All working perfectly.

    Then, I asked the web-host to delete the subdomain (dev.somesite.com) and now point 'somesite.com' to the 'webroot' folder ready to go live.

    After that change friendly urls stopped working. The symptom is this: Home page is ok, loads in and reads as url somesite.com. However! any link or navigation now has this symptom: somesite.com/webroot/index.php/about-us/

    Anyone know the solution?

    This is the current .htaccess file

    ### SILVERSTRIPE START ###
    <Files *.ss>
       Order deny,allow
       Deny from all
       Allow from 127.0.0.1
    </Files>

    <Files web.config>
       Order deny,allow
       Deny from all
    </Files>

    # This denies access to all yml files, since developers might include sensitive
    # information in them. See the docs for work-arounds to serve some yaml files
    <Files *.yml>
       Order allow,deny
       Deny from all
    </Files>

    ErrorDocument 404 /assets/error-404.html
    ErrorDocument 500 /assets/error-500.html

    <IfModule mod_alias.c>
       RedirectMatch 403 /silverstripe-cache(/|$)
       RedirectMatch 403 /vendor(/|$)
       RedirectMatch 403 /composer\.(json|lock)
    </IfModule>

    <IfModule mod_rewrite.c>
       SetEnv HTTP_MOD_REWRITE On
       RewriteEngine On
       RewriteBase '/'

       RewriteCond %{REQUEST_URI} ^(.*)$
       RewriteCond %{REQUEST_FILENAME} !-f
       RewriteCond %{REQUEST_URI} !\.php$
       RewriteRule .* framework/main.php?url=%1&%{QUERY_STRING} [L]
    </IfModule>
    ### SILVERSTRIPE END ###

    Many thanks!

  • Sean
    Avatar
    Forum Moderator
    921 Posts

    Re: Friendly URLs No Longer Working - After Domain Change - (SS 3.0) Link to this post

    One thing could be the RewriteBase, but if the site is in the same place but domain changed that shouldn't have affected rewriting.

    Perhaps something to check in with the host to see what's going on with the rewrite?

  • martimiz
    Avatar
    Forum Moderator
    1067 Posts

    Re: Friendly URLs No Longer Working - After Domain Change - (SS 3.0) Link to this post

    Also I think 'webroot' should never appear as a directory in the url regardless. Are you sure the domain isn't now for some reason pointing to the directory above?

    Curious: what happens when you remove index.php from the url by hand - does the correct page display?

  • ocean
    Avatar
    Community Member
    37 Posts

    Re: Friendly URLs No Longer Working - After Domain Change - (SS 3.0) Link to this post

    Thanks for the suggestions guys!

    Martimiz, interesting I remove 'by hand': webroot/index.php, leaving this: somesite.com/about-us. And it works, the correct page renders. Except in the case of a silver-stripe shop page which reverts to: 'http://www.somesite.com/webroot/shop/?url=/webroot/shop'

    I'm not much of an Apache/Webserver/Routing expert so not sure what to make of these symptoms, other than it seems a bit weird : )

  • martimiz
    Avatar
    Forum Moderator
    1067 Posts

    Re: Friendly URLs No Longer Working - After Domain Change - (SS 3.0) Link to this post

    One more question, just to be sure, dit you try flushing (or even emtying) your silverstripe cache after the domain change? (just to rule that out)

  • ocean
    Avatar
    Community Member
    37 Posts

    Re: Friendly URLs No Longer Working - After Domain Change - (SS 3.0) Link to this post

    Yes, there have been a number of dev/build and flush since the change of domain. I've also just created a silverstripe-cache in webroot and cleared that, the same problem persists.

  • martimiz
    Avatar
    Forum Moderator
    1067 Posts

    Re: Friendly URLs No Longer Working - After Domain Change - (SS 3.0) Link to this post

    By the way (forgot to ask this in the first place): does somesite.com/webroot/index.php/about-us/ actually display the correct page?

    Other possible questions (I'm in the blind here):

    - Does your hosting provider allow access to a control panel where you can see the actual webroot for your domain?
    - Can you print out the value of Director::baseURL()
    - For the 'fun' of it - what happens if you set RewriteBase /webroot in .htaccess?

    Oh, and you're not on GoDaddy?

  • ocean
    Avatar
    Community Member
    37 Posts

    Re: Friendly URLs No Longer Working - After Domain Change - (SS 3.0) Link to this post

    Thanks again martimiz for more suggestions : )

    Yes, all of those webroot/index.php links are rendering the correct pages it seems.

    - Its not my hosting server unfortunately, so not sure who the host is exactly but there is a cpanel, and I have WinSCP access to the root file structure, also the site was working perfectly ok prior to the domain switch (on same server).

    - Not sure how to print the value of 'Director::baseURL()'? Is there a way to do that with the debugging tools included in SS?

    - I did try that RewriteBase change in .htaccess as it happens, while exploring, and it made no difference.

    1693 Views
Page: 1 2
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.