Jump to content

Topic on Extension talk:Simple Farm

Combining Simple Farm with Short URL

4
Ali lsheikh (talkcontribs)

I'm wondering how to use short url with simple farm. I'm using scriptpath-based setup. I've added this rewrite rule and it worked fine, but with no short url.

RewriteRule ^(?!wiki(?:/|$))[^/]+(?:/(.*))?$ wiki/$1

I've tried to add rewrite rules for short url but with no success.

Danwe (talkcontribs)

Some more information would be helpful for analyzing your problem. It works for me but I guess there are a few other factors such as global variables that could effect a positive outcome.

Ali lsheikh (talkcontribs)

Here is my configuration: a folder named "fruits", and inside it another folder named "wiki" which contains the MediaWiki files.

I have the simple farm extension installed, with FarmMembers.php containing this code:

<?php
$egSimpleFarmMembers = array(
	array(
		'name' => 'Apple',
		'db' => 'apple',
		'addresses' => 'localhost',
		'scriptpath' => '/fruits/apple',
		'maintain' => false,
	)
);
?>

apache2.conf file has the following configuration:

<Directory /var/www/html/fruits>
  Options +FollowSymlinks
  <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteRule ^(?!wiki(?:/|$))[^/]+(?:/(.*))?$ wiki/$1
  </IfModule>
</Directory>

This all works correctly but problems arise when I want to add short URL to it using the apache2.conf file. I tried to add short URL rewrite rules after the simple farm one, and tried to combine both, but with no success. Could you please tell me which rewrite rules did you write to get it to work successfully?

To make things clear, what I want to accomplish is a URL like this: localhost/fruits/apple/Main_Page and not localhost/fruits/apple/index.php/Main_Page .. i.e. removing the index.php part

Danwe (talkcontribs)

Please read the comment provided together with the rewrite rule at Simple Farm - Setting-up Rewrite Rules for scriptpath based farm members.

It states No '/' allowed within the wiki path when using the rule, referring to RewriteRule ^(?!wiki(?:/|$))[^/]+(?:/(.*))?$ wiki/$1.

So if you are aiming for /fruits/apple and /fruits/strawberry instead of /apple and /strawberry you need to modify that rule accordingly, e.g. as in the example given in the very same code example from the section above: RewriteRule ^(?:fruits|fruits/apple|fruits/strawberry)(?:/(.*))?$ wiki/$1

Not sure you have anything else not configured accordingly, just try to change that first.

Reply to "Combining Simple Farm with Short URL"