Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » sapphire/main.php?url=/ at end of url???

Our old forums are still available as a read-only archive.

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

Page: 1
Go to End
Author Topic: 1996 Views
  • Josh
    Avatar
    SilverStripe Developer
    65 Posts

    sapphire/main.php?url=/ at end of url??? Link to this post

    When I visit my homepage "sapphire/main.php?url=/" is after the url. Anyone know why this is happening?

  • Liam
    Avatar
    Community Member
    470 Posts

    Re: sapphire/main.php?url=/ at end of url??? Link to this post

    I'm currently experiencing this with one of my sites.

    Was a reason ever found?

  • Willr
    Avatar
    Forum Moderator
    5462 Posts

    Re: sapphire/main.php?url=/ at end of url??? Link to this post

    ?url=/ gets appended if you try and visit yoursite.com/page rather then yoursite.com/page/ I think a simple .htaccess rule fixes that?

  • Liam
    Avatar
    Community Member
    470 Posts

    Re: sapphire/main.php?url=/ at end of url??? Link to this post

    I figured out it was an issue with my .htaccess.

    This part below:

    RewriteCond %{HTTP_HOST} !^(.*)\.domain\.ca$ [NC]
    RewriteRule ^(.*)$ http://www.domain.ca/$1 [R=301,L]

    Since sites with and without the www in the URL are treated as different sites from an SEO perspective, this helps solve that problem and stick to one.

    I'm only getting the junk part added on to the URL if I visit http://domain.ca since it then forwards to the WWW.

    Trying to work something out now...Not sure what I can do.

  • grilldan
    Avatar
    Community Member
    135 Posts

    Re: sapphire/main.php?url=/ at end of url??? Link to this post

    Try using a rewrite like this, instead of the one you are currently using.

    ### www Redirect Start ###
       RewriteCond %{HTTP_HOST} ^yoursite.com [NC]
       RewriteRule ^(.*)$ http://www.yoursite.com/$1 [L,R=301]
    ### www Redirect End ###

  • Liam
    Avatar
    Community Member
    470 Posts

    Re: sapphire/main.php?url=/ at end of url??? Link to this post

    Thanks, but same thing.

    Not really sure if there is a workaround for this, cause the .htaccess is valid. This is more of a CMS thing.

  • StuM
    Avatar
    Community Member
    56 Posts

    Re: sapphire/main.php?url=/ at end of url??? Link to this post

    I have similar to what has been stated, you just have to make sure it's before the SS rewrites. My file is:

    ### SILVERSTRIPE START ###
    RewriteEngine On
    RewriteBase /

    # Duplicate content prevention redirect
    RewriteCond %{HTTP_HOST} !^www.domain.com$ [NC]
    RewriteRule ^(.*)$ http://www.domain.com/$1 [L,R=301]

    RewriteCond %{REQUEST_URI} !(\.gif)|(\.jpg)|(\.png)|(\.css)|(\.js)|(\.php)$
    RewriteCond %{REQUEST_URI} ^(.*)$
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule .* sapphire/main.php?url=%1&%{QUERY_STRING} [L]
    ### SILVERSTRIPE END ###

    works great

  • Liam
    Avatar
    Community Member
    470 Posts

    Re: sapphire/main.php?url=/ at end of url??? Link to this post

    Nice! That did it. Great to know since I use this on all sites I build. Only noticed it on the one, but all would be effected.

    1996 Views
Page: 1
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.