Recent Topics

1 Dec 21, 2008 13:15    

My b2evolution Version: 2.x

All right, I detect something that I wanna solve, which is a strange behavior when you use the .htaccess for make url prettier. You'll see, with this lines of code:

AddHandler x-httpd-php5 .php
# 

RewriteEngine On

# Redirect anything that's not an existing directory or file to index.php
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php

I can make work those pretty url, however... another issues to solve did appear with that! For example, if you have in your skin things like this

<a href="<?php $Blog->disp( 'rss_url', 'raw' ) ?>">rss 9.2</a>
<a href="<?php $Blog->disp( 'rdf_url', 'raw' ) ?>">rdf</a>
<a href="<?php $Blog->disp( 'rss2_url', 'raw' ) ?>">rss2</a>
<a href="<?php $Blog->disp( 'atom_url', 'raw' ) ?>">atom</a>

The feeds wont work, as the "index.php" is taken off the url (I want it off urls, but not these ones, coz otherwise... it wont work!!!) Yet, this is the least of all the problems, as if you reemplace the php code directly with the url of the feed, it will work. So at least this one wont be an issue...

... but the other glitches are more important: the search box and the pagination: how could I solve those complete url roots, keeping the nice, clean & seo friendly url's? Is there any thread in the past that already asked this before? (I look for some clues, but I guess I wasnt handy enough... as the cookies issue was my b2evo to-do of the week ;-) Where could I add code, in order to make this work?

PS: Perhaps this behaviour might happen in other url constructions, but so far, these are the ones I saw!

3 Dec 27, 2008 15:31

Hi Sam, thanks to reply... unfortunately, the russian translation makes a funny usage of the language... I *tried* to do it (a couple of times) but... dunno if it was the proxy cache of my isp (something is giving me tons of headaches!) or what else, but it remains as it was before... what I did understood from babelfishes % googtrans, was that I need to modify the absolute url in the url blog setup (or something like that)

So if you (or anybody!) could gave me some leads in order to make it work... I guess this is a very useful thing, that might be needed to be added to the wiki, since I guess Im not the only one who wants to have pretty url's! :D Thanks in advance! :D

4 Dec 27, 2008 18:45

Ok, here's a brief instructions on how to use "nice urls" in b2evo.

The following is true for single blog installation only.

.htaccess (single blog)

#===============
# CATCH EVERYTHING INTO B2EVO:

<IfModule mod_dir.c>
DirectoryIndex index.php index.html
</IfModule>

Options +FollowSymlinks
RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php

After you put it in domain root go to Blog settings > URLs and set Absolute URL to: blog url without ending index.php (same as $baseurl selected upon installation)

It should look like "http://www.blog.com/" (without quotes).

#############################

If you have several blogs you should better do the following.
I presume you already use stub files to call each blog (default installation - blog1.php, blog2.php, blog6.php etc). If not, then for each blog set Absolute URL to "http://www.blog.com/blog1/"
"http://www.blog.com/blog2/" (or use your own names)

To remove .php from stub file name put the following code in .htaccess replacing blog1, blog2 etc. with real names selected in Absolute URl.

.htaccess (multiple blogs)

#===============
# CATCH EVERYTHING INTO B2EVO:

<IfModule mod_dir.c>
DirectoryIndex index.php index.html
</IfModule>

Options +FollowSymlinks
RewriteEngine on

# Add new blogs here
RewriteCond %{REQUEST_FILENAME} !-s
RewriteRule ^(blog1|blog2|blog3|blog4)(/.*)?$  $1.php

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php 

Then you can access your blog by typing
blog1 - "http://www.blog.com/blog1/"
category - "http://www.blog.com/blog1/category/"

Note: if you get 500 server error remove/comment the string Options +FollowSymlinks .

5 Dec 27, 2008 21:02

Wow, now that I read it in english, I solve it in a glance man!!! :D (there was a small twist of the automatic translation... but now I could it solve it at the first try!!!)

PS: This tip should deffinetly be included at the wiki!!! :D


Form is loading...