Hello,
Please bear with me, I'm really new to using wikimedia, and am not familiar with .htaccess work.
I have searched the mailing list archives, but haven't found much. I have Googled, and have read several times the manual ('short URL' and 'using very short URL' in particular). I have attempted several variations of the suggestions found there, but I must be missing something relatively simple... Problem is, I have no idea what I'm missing.
I am putting in a new wiki. I have the install in the root of the domain. Currently, my urls look like:
http://mydomain.com/index.php?title=Main_Page
First, I want to make sure that the www is never used in urls, and that if someone types in www.mydomain.com, the page that loads is mydomain.com. I think have managed to stop jumping from www to no-www between loging in by using $wgServer = "http://mydomain.com"; in my localsettings.php page, but someone can still load a page by typing the www in the address bar. Any thoughts on this one?
Second, I'm wanting to get Short URL/Very Short URL working. I'm looking at using the .htaccess rewrite method, but all .htaccess example base themselves on the wiki being installed in /wiki or /w and I can't figure out how to get this to work? Would anyone have a working .htaccess sample for a wiki installed at /root ?
Finally, what I'd *prefer* would be to reflect the site's structure within the URL, and end up with something like:
http://mydomain.com/category/subcategory/article or http://mydomain.com/category/article
This obviously addresses those pages which belong in categories and/or subcategories only.
Thank you for any assistance or pointers on this topic,
Sean
I am putting in a new wiki. I have the install in the root of the domain. Currently, my urls look like:
It might well be easiest to move the installation to a subfolder (/w/ seems to be standard). The problem with having it in the root directory is that the url for the file "index.php" is the same as the url for the article "index.php", which makes everything rather complicated.
First, I want to make sure that the www is never used in urls, and that if someone types in www.mydomain.com, the page that loads is mydomain.com. I think have managed to stop jumping from www to no-www between loging in by using $wgServer = "http://mydomain.com"; in my localsettings.php page, but someone can still load a page by typing the www in the address bar. Any thoughts on this one?
That seems fine to me.
Finally, what I'd *prefer* would be to reflect the site's structure within the URL, and end up with something like:
http://mydomain.com/category/subcategory/article or http://mydomain.com/category/article
This obviously addresses those pages which belong in categories and/or subcategories only.
The problem is that the category structure doesn't really work like that. An article can be in multiple categories, and there can only be one article with each name, even in different categories. Having the urls like that would be redundant, you would simply have to ignore the category and subcategory parts, so why make your users type them in?
On 8/8/07, Sean O'Connor sean@transabled.org wrote:
First, I want to make sure that the www is never used in urls, and that if someone types in www.mydomain.com, the page that loads is mydomain.com. I think have managed to stop jumping from www to no-www between loging in by using $wgServer = "http://mydomain.com"; in my localsettings.php page, but someone can still load a page by typing the www in the address bar. Any thoughts on this one?
Google "redirect non-www to www" for this one, and you'll get the proper .htaccess majeek:
Options +FollowSymLinks RewriteEngine on RewriteCond %{HTTP_HOST} . RewriteCond %{HTTP_HOST} !^mydomain.com RewriteRule (.*) http://mydomain.com/$1 [R=301,L]
(Not the only way to do it, I'm sure.)
Sean, re: "> First, I want to make sure that the www is never used in urls, and
that if someone types in www.mydomain.com, the page that loads is mydomain.com. I think have managed to stop jumping from www to no-www between loging in by using $wgServer = "http://mydomain.com"; in my localsettings.php page, but someone can still load a page by typing the www in the address bar. Any thoughts on this one?"
I am only beginnig with mediaWiKi so I do not know what you might be able to do there but you can force everyone to use http://mydomain.com by setting the DNS. Go to your Registra and remove the www pointer and add just mydomain mydomain will of course point to your IP.
Ralph
----- Original Message ----- From: "Sean O'Connor" sean@transabled.org To: mediawiki-l@lists.wikimedia.org Sent: Wednesday, August 08, 2007 12:24 AM Subject: [Mediawiki-l] Short URL reflecting wiki structure, no www
Hello,
Please bear with me, I'm really new to using wikimedia, and am not familiar with .htaccess work.
I have searched the mailing list archives, but haven't found much. I have Googled, and have read several times the manual ('short URL' and 'using very short URL' in particular). I have attempted several variations of the suggestions found there, but I must be missing something relatively simple... Problem is, I have no idea what I'm missing.
I am putting in a new wiki. I have the install in the root of the domain. Currently, my urls look like:
http://mydomain.com/index.php?title=Main_Page
First, I want to make sure that the www is never used in urls, and that if someone types in www.mydomain.com, the page that loads is mydomain.com. I think have managed to stop jumping from www to no-www between loging in by using $wgServer = "http://mydomain.com"; in my localsettings.php page, but someone can still load a page by typing the www in the address bar. Any thoughts on this one?
Second, I'm wanting to get Short URL/Very Short URL working. I'm looking at using the .htaccess rewrite method, but all .htaccess example base themselves on the wiki being installed in /wiki or /w and I can't figure out how to get this to work? Would anyone have a working .htaccess sample for a wiki installed at /root ?
Finally, what I'd *prefer* would be to reflect the site's structure within the URL, and end up with something like:
http://mydomain.com/category/subcategory/article or http://mydomain.com/category/article
This obviously addresses those pages which belong in categories and/or subcategories only.
Thank you for any assistance or pointers on this topic,
Sean
MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
It might well be easiest to move the installation to a subfolder (/w/ seems to be standard). The problem with having it in the root directory is that the url for the file "index.php" is the same as the url for the article "index.php", which makes everything rather complicated.
I don't understand that logic. Whether I put everything in a subdirectory or not, all the wiki installation is in the same folder, hence the url for the file index.php will be the same url for the article's index.php. Whether it lives in /wiki, /w, /bozo or /root, it'll all be the same issue, won't it?
I think have managed to stop jumping from www to no-www between loging in by using $wgServer = "http://mydomain.com"; in my localsettings.php page, but someone can still load a page by typing the www in the address bar. Any thoughts on this one?
That seems fine to me.
Yes, it's fine, but it doesn't stop people from typing the www in their address bar and loading the site that way. I don't want that to happen.
However, someone else suggested a bit of .htaccess that should work. BTW, thanks for the suggestion to Google it. I tend to do that anyway, but I guess I missed that.
The problem is that the category structure doesn't really work like that. An article can be in multiple categories, and there can only be one article with each name, even in different categories. Having the urls like that would be redundant, you would simply have to ignore the category and subcategory parts, so why make your users type them in?
It's not about making user type them in. It's about imparting a sense of the site's structure to the user. It has to do with usability and accessibility. It's obviously not mission critical, but it would be better. Obviously, having content in multiple categories might be a problem. Have to ponder this. Surely I'm not the first one to want to do this, nor the only one?
you can force everyone to use http://mydomain.com by setting the DNS. Go to your Registra and remove the www pointer and add just mydomain mydomain will of course point to your IP.
Don't have any www pointers at the registrar :)
Sean
The problem with having it in the root directory is that the url for the file "index.php" is the same as the url for the article "index.php", which makes everything rather complicated.
I don't understand that logic. Whether I put everything in a subdirectory or not, all the wiki installation is in the same folder, hence the url for the file index.php will be the same url for the article's index.php. Whether it lives in /wiki, /w, /bozo or /root, it'll all be the same issue, won't it?
Null article path is evil (i.e. risky/dangerous); it causes confusion between wiki pages and server files/folders.
For example, try accessing the robots.txt or favicon.ico (for the uninitiated, those are two rather crucial files that should be present and accessible on any Web server): http://docs.jquery.com/robots.txt http://docs.jquery.com/favicon.ico That will lead you to the respective wiki page, instead of to the file you actually needed.
I guess there are a number of other issues with this as well, but I'd have to ask Brion for details.
-- F.
On 8/8/07, Sean O'Connor sean@transabled.org wrote:
I think have managed to stop jumping from www to no-www between loging in by using $wgServer = "http://mydomain.com"; in my localsettings.php page, but someone can still load a page by typing the www in the address bar. Any thoughts on this one?
That seems fine to me.
Yes, it's fine, but it doesn't stop people from typing the www in their address bar and loading the site that way. I don't want that to happen.
However, someone else suggested a bit of .htaccess that should work. BTW, thanks for the suggestion to Google it. I tend to do that anyway, but I guess I missed that.
Do you want "www.domain.com" to NOT work, or to redirect so that it ends up being "domain.com" if they try it?
You can do the redirect with a DNS setup called a "CNAME". You point the name "www.domain.com" to the canonical name "domain.com". Anyone who does a name lookup in DNS for "www.domain.com" gets the response back "www.domain.com is domain.com" and will proceed appropriately.
If you don't want to return any values if someone connects to www.domain.com then that's a simple matter of not having a DNS entry for www.domain.com at all. No entry, no lookup works for it, and they won't get to domain.com if they try.
Short URLs work for my http://wikigogy.org wiki
See * http://www.mediawiki.org/wiki/Manual:Short_URL * http://www.mediawiki.org/wiki/Manual:Wiki_in_site_root_directory * http://www.mediawiki.org/wiki/Manual:Flat_namespace * http://www.mediawiki.org/wiki/Help:Subpages * http://www.mediawiki.org/wiki/Help:Categories
As for file or directory names coexisting with the wiki namespace (root dir of your wiki as root dir of your site), that is handled fine for me by this part of my .htaccess that prevents my wiki from interfering with real files (!-f) and directories (!-d) that happen to be in my website root dir (eg mysite.com/here):
RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d
For the curious, my full .htaccess looks like this:
#MediaWiki requries PHP5, so: AddHandler application/x-httpd-php5 .php Options FollowSymLinks RewriteEngine On # # Dreamhost stuff # prevent your Dreamhost /stats from breaking # (see http://wiki.dreamhost.com/index.php/Mod_rewrite) RewriteCond %{REQUEST_URI} ^/stats/(.*)$ [OR] RewriteCond %{REQUEST_URI} ^/failed_auth.html$ RewriteRule ^.*$ - [L] # end of Dreamhost stuff # # Short URLs stuff: RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d # Use this one if you are using *ugly URLs* -- PHP as CGI: RewriteRule ^(.+)$ /index.php?title=$1 [L,QSA] # Use this one if you are using *pretty URLs* -- PHP as Apache module: #RewriteRule ^(.+)$ /index.php/$1 [L,QSA]
I don't host it at Dreamhost anymore because of server slowdowns there. My wiki is now snappy at Dathorn.com. They don't overcrowd servers. But I've left those Dreamhost details there for folks who may find them helpful.
My wiki running above .htacces is http://wikigogy.org
If anyone is aware of SECURITY ISSUES I have created by running my wiki in the root of my site (it is a wiki only site so I like it there), please comment on:
* http://www.mediawiki.org/wiki/Manual:Wiki_in_site_root_directory
THANKS
Cheers, Roger
On 8/9/07, Roger Chrisman roger@rogerchrisman.com wrote:
Short URLs work for my http://wikigogy.org wiki
Roger, thanks. Using your .htaccess I was able to get it going in /root.
I am also able to call directly files that are in /root but aren't part of the wiki, without the wiki thinking it needs to create them.
The site is only a wiki site as well and will not hold anything else than the wiki.
Much obliged :)
Sean
P.S. I'm not sharing link to it yet, as there's still some work to be done on the skin (making it work in IE).
As for file or directory names coexisting with the wiki namespace (root dir of your wiki as root dir of your site), that is handled fine for me by this part of my .htaccess that prevents my wiki from interfering with real files (!-f) and directories (!-d) that happen to be in my website root dir (eg mysite.com/here):
What do you do if you want to have an article called robots.txt, or index.php, or whatever?
What do you do if you want to have an article called robots.txt, or index.php, or whatever?
That might be a problem, yes, but in my situation, it's unlikely to happen. :)
Sean
Thomas Dalton wrote:
As for file or directory names coexisting with the wiki namespace (root dir of your wiki as root dir of your site), that is handled fine for me by this part of my .htaccess that prevents my wiki from interfering with real files (!-f) and directories (!-d) that happen to be in my website root dir (eg mysite.com/here):
What do you do if you want to have an article called robots.txt, or index.php, or whatever?
If you want a wiki *article* on one of those topics, add a twist of lime. Maybe something like [[About robots.txt]] or [[About index.php]].
Cheers,
Sean O'Connor wrote:
Second, I'm wanting to get Short URL/Very Short URL working. I'm looking at using the .htaccess rewrite method, but all .htaccess example base themselves on the wiki being installed in /wiki or /w and I can't figure out how to get this to work? Would anyone have a working .htaccess sample for a wiki installed at /root ?
They'd be equivalent, but you should always put some folder there, having every file as a wiki-article gives to problems when you want non-wiki file on your site (eg. robots.txt).
Finally, what I'd *prefer* would be to reflect the site's structure within the URL, and end up with something like:
http://mydomain.com/category/subcategory/article or http://mydomain.com/category/article
This obviously addresses those pages which belong in categories and/or subcategories only.
This isn't really categories. I think you're searching some kind of subpages (which you need to enable and may not do everything you expect them to)
On 8/9/07, Frederik Dohr fdg001@gmx.net wrote:
Null article path is evil (i.e. risky/dangerous); it causes confusion between wiki pages and server files/folders.
For example, try accessing the robots.txt or favicon.ico (for the uninitiated, those are two rather crucial files that should be present and accessible on any Web server): http://docs.jquery.com/robots.txt http://docs.jquery.com/favicon.ico That will lead you to the respective wiki page, instead of to the file you actually needed.
Ok. I buy that. I think it's a shortcoming of the system, but that's for another discussion.
So, assuming I move everything to /wiki, and before I worry about short urls, what is the best way to ensure that when someone types just the domain name (http://mydomain.com ) they load the wiki? an htaccess redirect in the domain root? Seems like that might impact on SEO maybe? Dunno, open to suggestions.
On 8/9/07, Platonides Platonides@gmail.com wrote:
http://mydomain.com/category/subcategory/article or http://mydomain.com/category/article
This obviously addresses those pages which belong in categories and/or subcategories only.
This isn't really categories. I think you're searching some kind of subpages (which you need to enable and may not do everything you expect them to)
No, I am not talking about subpages (well, i don't think I am). If I have a category:people and an article 'Joe Q Public' that belongs to that category, i'd like the url to be /people/joe_q_public.
As someone else pointed out, this may become a problem if the article belongs to more than one category though.
Sean
mediawiki-l@lists.wikimedia.org