FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » FUDforum » FUDforum Suggestions » Shorten URLs with MOD_REWRITE
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
Shorten URLs with MOD_REWRITE [message #21896] Mon, 27 December 2004 15:15 Go to next message
naudefj is currently offline  naudefj   South Africa
Messages: 3772
Registered: December 2004
Karma: 28
Senior Member
Administrator
Core Developer
Hi,

The PATH_INFO feature is great, but I would like to shorten the URL even further using mod_rewrite. However, string "/index.php" is hard coded into the source and will always resurface in hyperlinks. Would it be possible to remove this from the source code and make it a variable (GLOBALS.php)?

Best regards.

Frank
Re: Shorten URLs with MOD_REWRITE [message #21901 is a reply to message #21896] Mon, 27 December 2004 21:20 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
It is not hardcoded into the source, it is specified inside the templates. If you can safely work without index.php, simply run something like this:

perl -p -i -e 's/index\.php//' *.tmpl

inside the template directory.


FUDforum Core Developer
Re: Shorten URLs with MOD_REWRITE [message #21913 is a reply to message #21901] Tue, 28 December 2004 16:19 Go to previous messageGo to next message
naudefj is currently offline  naudefj   South Africa
Messages: 3772
Registered: December 2004
Karma: 28
Senior Member
Administrator
Core Developer
Do you mean remove {ROOT} from the FUDForumData/thm/path_info/tmpl/*.tmpl files?

Best regards.

Frank
Re: Shorten URLs with MOD_REWRITE [message #21915 is a reply to message #21913] Tue, 28 December 2004 16:38 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
yes, or modify compiler.inc not to put anything for ROOT.

FUDforum Core Developer
Re: Shorten URLs with MOD_REWRITE [message #21922 is a reply to message #21915] Tue, 28 December 2004 20:37 Go to previous messageGo to next message
Anonymous   South Africa
It works like a dream. Here is my .htaccess directives:

RewriteEngine On
RewriteBase /forum
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^forum/(.*) index.php/$1 [L]


Thank you very much for your assistance.

Best regards.

Frank
Re: Shorten URLs with MOD_REWRITE [message #21990 is a reply to message #21922] Thu, 06 January 2005 22:29 Go to previous messageGo to next message
srchild is currently offline  srchild   United Kingdom
Messages: 88
Registered: December 2003
Location: UK
Karma: 1
Member
Anonymous wrote on Tue, 28 December 2004 20:37

It works like a dream.

I was interested to try this.

I tried to modify compiler.inc not to put anything for ROOT, by changing:

$cmpl['ROOT'] = 'index.php';

to

$cmpl['ROOT'] = '';

but then my URL's lost not only index.php but also the directory name 'forum'

Trial and error showed that this works:

$cmpl['ROOT'] = '.';




Simon Child
Re: Shorten URLs with MOD_REWRITE [message #21993 is a reply to message #21896] Fri, 07 January 2005 05:29 Go to previous messageGo to next message
naudefj is currently offline  naudefj   South Africa
Messages: 3772
Registered: December 2004
Karma: 28
Senior Member
Administrator
Core Developer
Glad it is working for you as well. Maybe we should make this a sticky in the How-To forum Razz
Re: Shorten URLs with MOD_REWRITE [message #22002 is a reply to message #21993] Fri, 07 January 2005 19:41 Go to previous messageGo to next message
naudefj is currently offline  naudefj   South Africa
Messages: 3772
Registered: December 2004
Karma: 28
Senior Member
Administrator
Core Developer
One of my users just reported that paging through message pages doesn't work (Pages: [1 2 3 ...] at the bottom). It always shows the first page with latest messages.

The generated URL is http://mysite.com/forum/sf/thread/59/1/&start=40/0/
Removing the "&start=" part of the URL solves the problem.

Do you have the same problem on your forum? If not, I might have a setup problem.

Best regards.

Frank

Re: Shorten URLs with MOD_REWRITE [message #22005 is a reply to message #22002] Sat, 08 January 2005 00:24 Go to previous messageGo to next message
srchild is currently offline  srchild   United Kingdom
Messages: 88
Registered: December 2003
Location: UK
Karma: 1
Member
naudefj wrote on Fri, 07 January 2005 19:41

One of my users just reported that paging through message pages doesn't work (Pages: [1 2 3 ...] at the bottom). It always shows the first page with latest messages.

The generated URL is http://mysite.com/forum/sf/thread/59/1/&start=40/0/
Removing the "&start=" part of the URL solves the problem.

Do you have the same problem on your forum? If not, I might have a setup problem.


Works alright for me. The URL is:

http://www.mysite.org/forum/sf/thread/20/1/40/682/



Simon Child
Re: Shorten URLs with MOD_REWRITE [message #22024 is a reply to message #22005] Sun, 09 January 2005 19:48 Go to previous messageGo to next message
naudefj is currently offline  naudefj   South Africa
Messages: 3772
Registered: December 2004
Karma: 28
Senior Member
Administrator
Core Developer
I somehow cannot reproduce the problem anymore. Anyway, thank you for checking.

Best regards.

Frank
Re: Shorten URLs with MOD_REWRITE [message #28819 is a reply to message #22024] Fri, 11 November 2005 19:07 Go to previous message
hossam is currently offline  hossam   Egypt
Messages: 9
Registered: November 2005
Karma: 0
Junior Member
Works like a charm here too with some modifications..

in /include/compilers.inc $cmpl['ROOT'] = 's';

my mod_rewrite rules

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^/s(.*) /index.php/$1 [L]


my Fudforum installation dir is /
added AcceptPathInfo On in /etc/httpd/conf/httpd.conf

Now, forums looks "more" profissional as forum.com/s/t/3268/30e0a8b938d79cd5a1799ca5b455de6c/

Time to get rid of the session id part and to have articles name in URL for SEO purposes.

Cheers,
Hossam
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Users of FUDForm reply using wrong reply button
Next Topic: Edit User
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Wed Dec 18 02:03:07 GMT 2024

Total time taken to generate the page: 0.02253 seconds