Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Installing SilverStripe /

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

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

Friendly URLs No Longer Working - After Domain Change - (SS 3.0)


Go to End


13 Posts   4950 Views

Avatar
ocean

Community Member, 37 Posts

4 August 2013 at 11:15pm

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!

Avatar
Sean

Forum Moderator, 922 Posts

5 August 2013 at 10:55am

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?

Avatar
martimiz

Forum Moderator, 1391 Posts

5 August 2013 at 8:56pm

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?

Avatar
ocean

Community Member, 37 Posts

5 August 2013 at 9:27pm

Edited: 05/08/2013 9:28pm

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 : )

Avatar
martimiz

Forum Moderator, 1391 Posts

6 August 2013 at 8:40am

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)

Avatar
ocean

Community Member, 37 Posts

6 August 2013 at 9:47pm

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.

Avatar
martimiz

Forum Moderator, 1391 Posts

6 August 2013 at 10:29pm

Edited: 06/08/2013 10:32pm

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?

Avatar
ocean

Community Member, 37 Posts

6 August 2013 at 11:36pm

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.

Go to Top