Firefox PHP

Module: Search Engine Friendly URL's

Re: Module: Search Engine Friendly URL's
April 30, 2012 04:03PM
My phorum site is http://cratedigging.co

Trying to get this to work at Godaddy's Linux hosting and it's pooping out.
I called godaddy and they said it's custom work as expected.

This is the only thing I have in my .htaccess file...

AddHandler x-httpd-php5 .php
AddHandler x-httpd-php .php4

RewriteBase /

RewriteEngine On

# READ RULES
RewriteRule ^([0-9]*)/([0-9]*)/([0-9]*)/([0-9a-zA-Z\-_=]*)/(.*)$ read.php?$1,$2,$3,$4
RewriteRule ^([0-9]*)/([0-9]*)/([0-9]*)/(.*)$ read.php?$1,$2,$3

RewriteRule ^([0-9]*)/([0-9]*)/([0-9a-zA-Z\-_=]*)/(.*)$ read.php?$1,$2,$3
RewriteRule ^([0-9]*)/([0-9]*)/(.*)$ read.php?$1,$2
RewriteRule ^([0-9]*)/([0-9]*)$ read.php?$1,$2



# DEFAULT RULES
RewriteRule ^([a-z]*)/([0-9]*)/([0-9a-zA-Z=_\-]*)/([0-9a-zA-Z=_\-]*)/([0-9a-zA-Z=_\-]*)$ $1.php?$2,$3,$4,$5
RewriteRule ^([a-z]*)/([0-9]*)/([0-9a-zA-Z=_\-]*)/([0-9a-zA-Z=_\-]*)$ $1.php?$2,$3,$4
RewriteRule ^([a-z]*)/([0-9]*)/([0-9a-zA-Z=_\-/:\.?]*)$ $1.php?$2,$3
RewriteRule ^([a-z]*)/([0-9]*)$ $1.php?$2
RewriteRule ^([a-z]+)$ $1.php

My Godaddy server is using Php.5.2 but I could update to 5.3?

Please help, I really want this to work.

Thanks,
Re: Module: Search Engine Friendly URL's
May 08, 2012 01:48PM
^Follow Up to my own question...

I FIXED IT!

The Godaddy work around is this...

.htaccess should contain this...

#Fix Rewrite
Options -Multiviews



 RewriteEngine On

 # READ RULES
 RewriteRule ^([0-9]*)/([0-9]*)/([0-9]*)/([0-9a-zA-Z\-_=]*)/(.*)$ read.php?$1,$2,$3,$4
 RewriteRule ^([0-9]*)/([0-9]*)/([0-9]*)/(.*)$ read.php?$1,$2,$3
 
 RewriteRule ^([0-9]*)/([0-9]*)/([0-9a-zA-Z\-_=]*)/(.*)$ read.php?$1,$2,$3
 RewriteRule ^([0-9]*)/([0-9]*)/(.*)$ read.php?$1,$2
 RewriteRule ^([0-9]*)/([0-9]*)$ read.php?$1,$2
 
 # DEFAULT RULES
 RewriteRule ^([a-z]*)/([0-9]*)/([0-9a-zA-Z=_\-]*)/([0-9a-zA-Z=_\-]*)/([0-9a-zA-Z=_\-]*)$ $1.php?$2,$3,$4,$5
 RewriteRule ^([a-z]*)/([0-9]*)/([0-9a-zA-Z=_\-]*)/([0-9a-zA-Z=_\-]*)$ $1.php?$2,$3,$4
 RewriteRule ^([a-z]*)/([0-9]*)/([0-9a-zA-Z=_\-/:\.?]*)$ $1.php?$2,$3
 RewriteRule ^([a-z]*)/([0-9]*)$ $1.php?$2
 RewriteRule ^([a-z]+)$ $1.php

Note the #Fixrewrite at the top line. Without it, on Godaddy hosting, this module will not work.
Re: Module: Search Engine Friendly URL's
June 08, 2012 03:22PM
Is it possible by installing this module it broke my banner manager? The banner only shows up now on the top level http://cratedigging.co whereas banners will not show now in my sub forums. They used to show up in any sub-forum I chose. Is there an edit to update this module or the banner manager module as to where the new urls are?
Re: Module: Search Engine Friendly URL's
August 30, 2012 12:29PM
Good Mod , Please Fix This To Support UTF-8 Languages , It Replace _____ to utf-8 words
Re: Module: Search Engine Friendly URL's
August 31, 2012 09:38AM
A note about hostgator.com

I had issues with rewrite and addon domains. A simple fix is to add:

<IfModule mod_rewrite.c>
RewriteBase /
rules here
</IfModule>


An easy fix for CSS and other image issues is to use the BASE tag in the header:

<base href="[www.yoursite.com]; /> or something along those lines. It should save you from having to specify the full paths/urls to your images in css and themes.

I guess each host has its quarks. =0D

~ Be Kind, Please Rewind! ~
Re: Module: Search Engine Friendly URL's
November 21, 2012 01:30AM
When I turn this mod on it mostly works. Like if I go to [myurl]/pm it will take me to the PM section. But when I click on a forum it just reloads the home page. Any ideas?
Re: Module: Search Engine Friendly URL's
September 20, 2013 09:20PM
Installed. Thanks for this!! It works well, just a couple spots where _subject_ didn't get converted to the thread title (e.g, last post and a couple other mods I installed) but easy to fix. For anyone having this problem, the simplest fix I found was to edit the sef_urls_start_output function of this mod (or another mod's file in certain cases).

What you do is print_r($PHORUM); on the page with the problem so you can see the variables of the page and search that for _subject_ which will let you know the array keys and such, so then you just code up a loop to str_replace the _subject_ text with sef_urls_convert($PHORUM['find']['with']['print_r']['subject']) and you're good to go.

This mod really made me appreciate the phorum_get_url function. Thanks again.
Re: Module: Search Engine Friendly URL's
October 14, 2013 12:24PM
1) Question
2) Fix for UTF-8 caracters!


1) Question: half of the plugin doesn't work. Some urls are not working (previous/next topic for instance), some urls are badly generated but are working: those from index (annoucements and the forums list does not have their name, just the numbers), etc.

Is it "normal" or not? (what may it come from?)

2) Small fix for those who doesn't want their UTF-8 special caracters to be reduced to "_". For example, I wanted "àéù" to be "aeu". Here we go, in sef_urls.php change this:

Language: PHP
function sef_urls_convert($strValue) { $strValue = preg_replace("/([^a-zA-Z0-9\-_\ ])/", "_", $strValue); $strValue = preg_replace("/([\ ])/", "_", $strValue);   $strValue = strtolower($strValue);   return $strValue; }

To this (//EDIT before changes, // after):

Language: PHP
function sef_urls_convert($strValue) { //EDIT setlocale(LC_ALL, ';fr_FR.UTF8';); $strValue = iconv(';UTF-8';, ';ASCII//TRANSLIT//IGNORE';, $strValue); // $strValue = preg_replace("/([^a-zA-Z0-9\-_\ ])/", "_", $strValue); $strValue = preg_replace("/([\ ])/", "_", $strValue);   $strValue = strtolower($strValue);   return $strValue; }

Of course, change the "fr_FR.UTF8" into "en_US.UTF8" if your forum is in english, etc.
Re: Module: Search Engine Friendly URL's
October 14, 2013 12:38PM
In fact I have a lot of "_subject_" and it breaks everything... :/
Re: Module: Search Engine Friendly URL's
October 14, 2013 03:38PM
Yes, this add-on needs work to function correctly. I've been hacking at my sef_url.php file for a bit now to get it to work, and it now has a bunch of site specific stuff in it.

Here is a better sef_urls_convert function with your change added:
Language: PHP
function sef_urls_convert($strValue) { setlocale(LC_ALL, ';en_US.UTF8';); $strValue = iconv(';UTF-8';, ';ASCII//TRANSLIT//IGNORE';, $strValue);   $strValue = preg_replace(';/([^a-z0-9\-])/i';, ';-';, $strValue); $strValue = preg_replace(';/-{2,}/';, ';-';, $strValue); $strValue = preg_replace(';/^-+|-+$/';, ';';, $strValue);   $strValue = strtolower($strValue); //if (!strlen($strValue)) { $strValue = ';link';; }   return $strValue; }
IMO replacing characters with "-" instead of "_" is preferred, and now you won't have any repeated dashes, start/end with a dash, or empty value if you don't want it.
Sorry, only registered users may post in this forum.

Click here to login