Recent Topics

1 Apr 20, 2009 17:53    

My b2evolution Version: 2.x

Ok, here's the problem. I have b2evo set up on my root directory. I have cubecart set up in a subdirectory /shop. I want to make my homepage redirect to /shop. I have set up a blog on b2evo and put in an absolute URL in the settings so the blog directs to /shop, and made this blog the default. That works fine, but if I go to my domain name (www.puppetsinmelbourne.com.au), it doesn't redirect to /shop.

I'm guessing this has something to do with .htaccess, but having never used it before I'm at a loss as to what to do with the file and what to put in there.

I've also tried doing a redirect from my cpanel, but every time I do it tells me I've got a redirect loop (I recently also changed all the blog pages so they use stubs, and have other redirects going from index.php/blog to /blog.php, etc. Is this causing a conflict and why I'm getting a loop?)

... I should add that I previously had this working with cubecart located in a different subdirectory, and for some reason I can't get this to work again.

3 Apr 22, 2009 07:04

If I set up my default blog as index.php and redirect it to /shop, it gives me a redirect loop; also if I go to the domain name (no index.php after it), it doesn't redirect to /shop.

I've tried all sorts of different URLs and redirects and it always ends up with a loop.

(Thanks for the suggestion. I think I've just fried my brain with this)

4 Apr 22, 2009 14:10

are you using a .htaccess file to do the redirects? or are you using a header redirect inside your index.php?

The out of the box index.php is used by all the blogs / sections of b2evo so - if you have your code inside the index.php - that's probably why you get the loop --- every section inside b2evo reads the index.php and so it reads the redirect, and keeps in redirecting you.

If you have access to an .htaccess file, consider it using it. this line of code should do it:

redirect 301 /blog/index.php https://www.puppetsinmelbourne.com.au/shop/

5 Apr 22, 2009 14:32

I'm using .htaccess. I don't have any meta-refresh codes in the index.php file (although I did at first, but then removed it, so there shouldn't be any conflicts with .htaccess)

This is what's in the .htaccess file, and you're suggestion doesn't seem to work. All the other redirects work fine.

# PHP5
# This may need to be in each folder:
# AddHandler application/x-httpd-php5 .php

# CLEAN URLS:
# If you're using Apache 2, you may wish to try this if clean URLs don't work:
# AcceptPathInfo	On


# DEFAULT DOCUMENT TO DISPLAY:
# this will select the default blog template to be displayed
# if the URL is just .../blogs/
<IfModule mod_dir.c>
	DirectoryIndex index.php index.html
</IfModule>


# CATCH EVERYTHING INTO B2EVO:
# The following will allow you to have URL right off the site root,
# using index.php as a stub but not showing it.
# This will add support for URLs like:  http://example.com/2006/08/29/post-title
# Redirect anything that's not an existing directory or file to index.php
#
# RewriteEngine On
# RewriteCond %{REQUEST_FILENAME} !-d
# RewriteCond %{REQUEST_FILENAME} !-f
# RewriteRule ^  index.php


Redirect permanent /index.php/blog /blog.php
Redirect permanent /index.php/thanks /thanks.php
Redirect permanent /index.php/about /about.php
Redirect permanent /index.php/blog /blog.php
Redirect permanent /index.php/archive /shopnews.php
Redirect permanent /index.php/books /books.php
Redirect permanent /index.php/building /building.php
Redirect permanent /index.php/chat /chitchat.php
Redirect permanent /index.php/direct /direct.php
Redirect permanent /cube /shop
Redirect permanent /index.php/discuss /discuss.php
Redirect permanent /index.php/events /events.php
Redirect permanent /index.php/faq /faq.php
Redirect permanent /index.php/forgal /forgal.php
Redirect permanent /index.php/gallery /gallery.php
Redirect permanent /index.php/help /help.php
Redirect permanent /index.php/links /links.php
Redirect permanent /index.php/intro /intro.php
Redirect permanent /index.php/map /map.php
Redirect permanent /index.php/members /members.php
Redirect permanent /index.php/perform /perform.php
Redirect permanent /index.php/resources /resources.php
Redirect permanent /index.php/scripts /scripts.php
Redirect permanent /index.php/search /search.php
Redirect permanent /index.php/staging /staging.php


redirect 301 /blogs/index.php https://www.puppetsinmelbourne.com.au/shop/

6 Apr 22, 2009 15:07

So how about using stub files for everything except the /shop thing. For that just pretend it's a blog with a specific URL. Then you can redirect your domain root to /shop and domain_root/index.whatever to /shop without b2evo getting involved. Because the use of stub files will eliminate b2evo caring about index.php.

7 Apr 22, 2009 19:48

Redirect permanent ^/index.php$ /shop/
Redirect permanent ^/$ /shop/

Untested of course :D

¥

8 Apr 23, 2009 04:16

@Edb, what caused all this is that I finally *have* started using stub files for all of my pages. Hence the need for all the redirects. At the same time I also wanted to change the location of my shopping cart system. No matter what I do, redirecting my root to /shop gives me a loop. I'm not sure if I already mentioned it, but I previously had a redirect working on my root, which worked fine, it's only once I started adding everything as stubs that it's given me loops.

@Yabba, thanks for the code, but it didn't work (giving no redirect at all). Does it matter if I have the
# CATCH EVERYTHING INTO B2EVO:
code in the file?

Thanks for the help guys, I appreciate it :)

9 Apr 23, 2009 09:48

Keep a copy of your htaccess and then try this instead ... if it barfs then slap your original back ;)

# DEFAULT DOCUMENT TO DISPLAY:
# this will select the default blog template to be displayed
# if the URL is just .../blogs/
<IfModule mod_dir.c>
   DirectoryIndex index.php index.html
</IfModule>

RewriteCond %{REQUEST_URI} ^/index\.php/archive
RewriteRule /index\.php/archive(.*) shopnews.php$1 [R=301,QSA,L]

RewriteCond %{REQUEST_URI} ^/index\.php/chat
RewriteRule /index\.php/chat(.*) chitchat.php$1 [R=301,QSA,L]

RewriteCond %{REQUEST_URI} ^/index\.php/[^/]/$
RewriteRule /index\.php/(.*)/ $1.php [R=301,QSA,L]

RewriteCond %{REQUEST_URI} ^/$
RewriteRule /(.*) /shop/$1 [R=301,QSA,L]

RewriteCond %{REQUEST_URI} ^/index\.php$
RewriteRule /index\.php(.*) /shop/$1 [R=301,QSA,L]

RewriteCond %{REQUEST_URI} ^/cube
RewriteRule /cube(.*) /shop$1 [R=301,QSA,L]

RewriteCond %{REQUEST_URI} ^/blogs/index\.php
RewriteRule /blogs/index\.php(.*) /shop$1 [R=301,QSA,L]

¥

10 Apr 23, 2009 10:10

That didn't work either. No redirect at all from the root to /shop, let alone a loop. :(

11 Apr 23, 2009 14:44

Do you fancy sending me an ftp login so that I can have a play?

¥

12 Apr 23, 2009 16:49

Sure Yabba, will PM you.

14 Apr 23, 2009 19:34

Thank you!!!!

What did you do for future reference?

15 Apr 23, 2009 20:18

In your htaccess

RewriteEngine On ## uncommented this line
# RewriteCond %{REQUEST_FILENAME} !-d
# RewriteCond %{REQUEST_FILENAME} !-f
# RewriteRule ^  index.php

## moved this bit up a smidge
# Redirect non-www to www
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule (.*) http://www.puppetsinmelbourne.com.au/$1 [R=301,L]

Bad news is, your htacces works in a weird way, allowed some redirects and not others, but I stopped playing because your visitors are probably less used to 500's && 404's ( even 403's on occasion ), than mine are ;)

¥

*edit*

Oh yeah, I also added this bit ;)

Redirect permanent /index.php /shop/

16 Apr 23, 2009 20:24

Thanks so much! That really helps me understand where the problem lay and how to do this again (if necessary) in the future. :)


Form is loading...