[pmwiki-users] I need help with clean URLs

info at theburroughsproject.com info at theburroughsproject.com
Sat Aug 12 17:54:31 CDT 2006


>    apparently some GoDaddy accounts don't support htaccess, or
>    at least not "out of the box". First, I note that all of 
>    GoDaddy's documentation refers to "htaccess" without the dot,
>    so you might try renaming ".htaccess" to "htaccess" and see 
>    if that fixes anything.

I tried this, and it didn't work, but I later noticed other godaddy
documentation that refered to ".htaccess" (with the dot), so I think
it probably should have the dot.

>    If that doesn't work, it may be that you need to "upgrade your
>    account to run Hosting Configuration 2.0", whatever that means.

I'm already using hosting configuration 2.0

>    you are running a GoDaddy account that is using Apache as the
>    webserver, yes?  (Is it a Linux account or a Windows account?)

Yes, it's definately Apache/Linux. 

Here's a couple of things I found at godaddy on the issue:

>    How do I use mod_rewrite?
>    Last Updated: July 27, 2006 5:05 PM Print This Article  
>
>    Mod_rewrite is an Apache web server module installed on all of
>    our Linux severs by default; it does not have to be installed or
>    enabled. Our Linux hosting accounts support most mod_rewrite
>    functionality.
>
>    You will not need to enable mod_rewrite in your httpd.conf, as
>    this is handled at a global level. All you will need to do is add
>    the desired code to the body of your .htaccess file.

There's also this, if it helps:

>    By default, files with a .php extension run under PHP 4 and files
>    with the .php5 extension run under PHP 5. The htaccess file,
>    located at the root of your site, can be used to change these
>    default settings. The following entries in a directory's htaccess
>    file designate .php files to run under PHP 5 and .php4 files to run
>    under PHP 4.
>
>        AddHandler x-httpd-php5 .php
>        AddHandler x-httpd-php .php4
>
>    Changes made to an existing htaccess file will be seen immediately.
>    When a new htaccess file is created or an existing htaccess file is
>    deleted, however, these changes will not be seen until the htaccess
>    cache is cleared. This occurs every hour.

I don't know, it kind of looks everything is in place for this to work.
I now have both an ".htaccess" and an "htaccess" file in my main
directory, so I'll wait an hour (for the htaccess cache to clear) and
see
if there's any change. I talked to godaddy before I brought this up in
the
group, but the guy I talked to didn't really get it, I don't think, so I
may just need to hunt down someone at godaddy who does.

Thanks for all your help, I can't tell you how much I appreciate your
spending time on this. If you see anything above that makes a bulb light
up over your head, let me know. And If I get it figured out on my own,
I'll let you know what happened.

Thanks,
Phil


----


On Sat, Aug 12, 2006 at 01:23:00PM -0700, info at theburroughsproject.com
wrote:
> Patrick, thank you very much for clearing all that up. Unfortunately,
> this still isn't working for me. This is what I've done:
> 
> I created an "index.php" file, that contains the single line:
> <?php include_once('pmwiki.php');
> 
> This works fine for making "www.example.com" work. 

Excellent!

> Then I created an .htaccess file with exactly this in it:
> 
> # Use mod_rewrite to enable "Clean URLs" for a PmWiki installation.
> RewriteEngine On
> # The rewrite base will be the document root.
> RewriteBase /
> # Send requests without parameters to pmwiki.php.
> RewriteRule ^$           pmwiki.php  [L]
> # Send requests for index.php to pmwiki.php.
> RewriteRule ^index\.php$ pmwiki.php  [L]
> # Send requests to pmwiki.php, appending the query string part.
> RewriteRule ^([^/a-z].*) pmwiki.php?n=$1  [QSA,L]
> 
> and placed it in my main web folder (the same one that contains
> "pmwiki.php").
> 
> At this point URLs like "www.example.com/SomeGroup/SomePage" do not
> work, I just get a 404, but the old URLs, with the
> "?n=SomeGroup.SomePage" still work fine.

Hmm.  I've done some reading on this, and apparently some GoDaddy
accounts don't support htaccess, or at least not "out of the box".

First, I note that all of GoDaddy's documentation refers to
"htaccess" without the dot, so you might try renaming ".htaccess"
to "htaccess" and see if that fixes anything.

If that doesn't work, it may be that you need to "upgrade your account 
to run Hosting Configuration 2.0", whatever that means.  GoDaddy
describes
this somewhat at 
http://help.godaddy.com/article.php?article_id=1082&prog_id=GoDaddy .

> I went ahead and tried the next step, to see what would happen, adding:
> 
> <?php if (!defined('PmWiki')) exit();
> $EnablePathInfo = 1;
> $ScriptUrl = 'http://www.example.com';
> ## remainder of configuration goes here
> 
> to my config file, and now the links point to clean URLs, but I still
> get the 404 when I click them (the old URLs still work, though).

Yes, until we get the rewrite rules working the clean urls won't work.

> Or is it possible that I need to create a php.ini file with something in
> it? I know my hosting service will allow this, and I seem to remember
> that coming up in another post in the archive...

It's not affected by the php settings at all -- at this point it's
all trying to get Apache to do the right thing.  And, just to make
sure, you are running a GoDaddy account that is using Apache as
the webserver, yes?  (Is it a Linux account or a Windows account?)

Hope this helps,

Pm


> On Fri, Aug 11, 2006 at 11:57:29PM -0700, info at theburroughsproject.com
> wrote:
> > Hello. I'm having a very difficult time getting clean URLs. I have my
> > pmwiki.php file and all of the folders in my main directory. 
> > 
> > Right now my URLs look like this:
> > www.example.com/pmwiki.php?n=SomeGroup.SomePage
> > 
> > I want my URLs to look like this:
> > www.example.com/SomeGroup/SomePage
> > 
> > And I'd like, if possible, for the Main.HomePage URL to just be:
> > www.example.com/
> 
> This looks like "Example Three" from the Cookbook.CleanUrls
> page, so you'll want to follow it.
> 
> First, let's get www.example.com/ to work for your Main.HomePage.
> Create a file called 'index.php' in the same directory as pmwiki.php,
> in that file place the line:
> 
>    <?php include_once('pmwiki.php');
> 
> After doing this, then the url http://www.example.com/ should
> automatically display the Main.HomePage.
> 
> Okay, now for the rest of the clean urls.  Create a file called
> '.htaccess' in the same directory as pmwiki.php, and in that
> file include the following lines:
> 
>    # Use mod_rewrite to enable "Clean URLs" for a PmWiki installation.
>    RewriteEngine On
>    # The rewrite base will be the document root.
>    RewriteBase /
>    # Send requests without parameters to pmwiki.php.
>    RewriteRule ^$           pmwiki.php  [L]
>    # Send requests for index.php to pmwiki.php.
>    RewriteRule ^index\.php$ pmwiki.php  [L]
>    # Send requests to pmwiki.php, appending the query string part.
>    RewriteRule ^([^/a-z].*) pmwiki.php?n=$1  [QSA,L]
> 
> After making this change, urls that look like
> www.example.com/SomeGroup/SomePage should work.
> 
> Lastly, we need to configure PmWiki to use the new "clean" urls
> instead of its default, thus in local/config.php, place the lines
> 
>    <?php if (!defined('PmWiki')) exit();
>    $EnablePathInfo = 1;
>    $ScriptUrl = 'http://www.example.com';
>    ## remainder of configuration goes here
> 
> This will tell PmWiki to generate its links using the
> www.example.com/SomeGroup/SomePage format instead of
> www.example.com/pmwiki.php?n=SomeGroup.SomePage .
> 
> > For example, whenever it mentions "~someuser", is that the same as
> > saying "somefolder"? Or is there a significance with the "~" and the
> > term "user"? What's a "user" in this context?
> 
> Aha, you've found a hole of sorts in the CleanUrls description.
> CleanUrls was written from the perspective of someone having
> installed PmWiki into a per-user directory on a server, where
> urls all tend to begin with the user's name.  But your situation
> is running PmWiki from the document root directory, or from
> a place that isn't associated with the server's user accounts.
> In fact, I'd tend to think that your situation is the more common
> one.
> 
> So, perhaps what we need to do is to eliminate the "~someuser"
> references and just use "path/to/pmwiki" instead, so that
> the administrator understands to simply replace that component
> of the path (without any reference to "~someuser").
> 
> Any comments from the group?
> 
> > And where it says:
> > 
> > >   Here's the matching local/config.php file: 
> > >
> > >   <?php if (!defined('PmWiki')) exit();
> > >   ## Use "Clean URLs".
> > >   $EnablePathInfo = 1;
> > >   $ScriptUrl = "http://server.example.com/~someuser/pmwiki";
> > >   ## more configuration settings...
> > 
> > what does the "server" in "server.example.com/~someuser/pmwiki";"
> > supposed to be? Am I supposed to change that to something? 
> 
> That's a typo in the recipe, it should match all of the other
> server references --- i.e., it should also be "www.example.com".
> 
> > If someone could dumb this down for me, just give me a more "plain
> > language" step-by-step that's not way over my head, I'd really
> > appreciate it a lot. I've been trying different things for quite some
> > time, and I just can't make it work. I don't know much about servers or
> > rewriting.
> 
> I hope the above is helpful -- if not, please keep asking.
> Your questions have already pointed out some important gaps
> in the current documentation, so this is a huge help to us all.
> 
> Thanks!
> 
> Pm 
> 
> 





More information about the pmwiki-users mailing list