[pmwiki-users] Clean URLs (Another question from the newbie)

Sameer Kumar skumar at eharch.com
Tue Dec 4 16:03:33 CST 2007


Oh! And I forgot to mention, I have confirmed that my "EnablePathInfo =
1" is correctly set.

 

From: pmwiki-users-bounces at pmichaud.com
[mailto:pmwiki-users-bounces at pmichaud.com] On Behalf Of Sameer Kumar
Sent: Tuesday, December 04, 2007 5:01 PM
To: Eric Celeste
Cc: pmwiki-users at pmichaud.com
Subject: Re: [pmwiki-users] Clean URLs (Another question from the
newbie)

 

http://hip.eharch.com/Main/Main does work and you can try it again (I
modified a minor issue). 

 

What I meant by 'typed in manually' is that when you click on any of the
sidebar links like 'Projects' or 'Materials' etc., the URL of the page
that opens has the "?n=" in it. However, if you manually delete these
three characters, the link still points to the same page. 

 

Moreover, if you click on the topmost header link like "Projects/" in
the Projects/Projects page, it goes to a URL without the "?n=". But that
I think was a modification made in the skin template, after suggestions
on this mailing list.

 

Having tried all that I could, I too am getting the feeling that this
may have something to do with my installation of PHP etc. But I am too
much of a newbie to try to do something about it.

 

I really appreciate your time and help.

 

 

From: Eric Celeste [mailto:efc.dev at gmail.com] 
Sent: Tuesday, December 04, 2007 4:00 PM
To: Sameer Kumar
Cc: pmwiki-users at pmichaud.com
Subject: Re: [pmwiki-users] Clean URLs (Another question from the
newbie)

 

I've only used Apache in a Unix environment, so I have no idea what
issues might be stirred up by this being a Windows environment.

 

> Interestingly, all the URLs when clicking Pmwiki internal links have
the "?n=" in them.  

> However, if one types an address without that, the wiki is able to
resolve it.

 

The "?n=" being there or not in the links should be controlled by the
$EnablePathInfo variable in the config.php file. Interestingly, the
comments about this in the config file state: "try setting
$EnablePathInfo below.  Note that this doesn't work in all environments,
it depends on your webserver and PHP configuration." Maybe there is
something else in the machine or PHP environment that is preventing
EnablePathInfo from doing it's job. 

 

As to why the link to http://hip.eharch.com/Main/Main does not work, I
am a bit more mystified. For one thing, I don't know what you mean by it
works if typed into directly. Typing a URL or clicking on it should make
no difference to how it is resolved, if it does make a difference, then
I'm out of my depth. When I try to go to that URL I get... 

 

   The requested URL /wiki/pmwiki.phpMain/Main was not found on this
server.

 

Notice the missing "/" between "php" and the first "Main". The only
thing I can think of is that your EnablePathInfo is actually not set to
"1". Check to make sure the "#" is removed at the front of that line in
your config.php file.

 

Good luck,

...Eric

 

On 12/4/07, Sameer Kumar < skumar at eharch.com <mailto:skumar at eharch.com>
> wrote:

Eric,

I have pmwiki installed with Apache running on a Windows XP machine.

My web root directory is C:\web

The full path of the pmwiki install is C:\web\wiki\pmwiki.php

The URL that I would like to be home is http://hip.eharch.com and this
works. 

Actually, my homepage is located at http://hip.eharch.com/Main/Main
which also works if directly typed into the browser URL bar.

 

My .htaccess file is located inside C:\web and its contents are as
follows:

 

# Use mod_rewrite to enable "Clean URLs" for a PmWiki installation.

RewriteEngine On

# Define the rewrite base.  It's not necessarily PmWiki's directory.

RewriteBase /

# Send requests without parameters to pmwiki.php.

RewriteRule ^$            /wiki/pmwiki.php  [L]

# Send requests for index.php to pmwiki.php.

RewriteRule ^index\.php$ /wiki/pmwiki.php  [L]

# Send requests to pmwiki.php, appending the query string part.

RewriteRule ^([A-Z0-9\xa0-\xff].*)$ /wiki/pmwiki.php?n=$1  [QSA,L]

 

Interestingly, all the URLs when clicking Pmwiki internal links have the
"?n=" in them. However, if one types an address without that, the wiki
is able to resolve it. 

For example, if you click "Projects" on the sidebar, it goes to 

http://hip.eharch.com/?n=Projects/Projects 

but if you manually type 

http://hip.eharch.com/Projects/Projects 

it still works.

 

Thanks for your attention.

Sameer

 

From: Eric Celeste [mailto: efc.dev at gmail.com <mailto:efc.dev at gmail.com>
] 
Sent: Tuesday, December 04, 2007 2:16 PM
To: Sameer Kumar
Cc: pmwiki-users at pmichaud.com
Subject: Re: [pmwiki-users] Clean URLs (Another question from the
newbie)

 

The only other problem I see is potentially the leading "/" on the
rewritten address. In other words, all the "/singles" below should
probably be "singles" instead (assuming "singles" is not actually at the
root of your hard disk). 

 

Really, to debug this would require more detailed information using only
full paths.

 

What is the full path of your pmwiki install? 

(for example "/home/efc/www/pmwiki/pmwiki.php")

 

What is the URL you would like to be "home" for your wiki?

(for example " http://mydomain.org/Main/HomePage")

 

What is the full path of your ".htaccess" file?

(for example "/home/efc/www/.htaccess") 

 

Assumption: your server is configured so that a request of a page from
your domain actually reaches your .htaccess file.

 

...Eric

 

On 12/4/07, Sameer Kumar <skumar at eharch.com> wrote:

 

<Snip>
Following the directions in the clean URL cookbook I set up my .htaccess
file in /website as follows:

# Use mod_rewrite to enable "Clean URLs" for a PmWiki installation.
RewriteEngine On 
# The rewrite base will be the document root.
RewriteBase /website
# Send requests without parameters to pmwiki.php.
RewriteRule ^$           /singles/pmwiki.php  [L]
# Send requests for index.php to pmwiki.php .
RewriteRule ^index\.php$ /singles/pmwiki.php  [L]
# Don't rewrite requests for any files, directories, or symbolic
# links (shortcuts) that exist on the filesystem.
# RewriteCond %{REQUEST_FILENAME} !-f
# RewriteCond %{REQUEST_FILENAME} !-d
# RewriteCond %{REQUEST_FILENAME} !-l # Send requests to pmwiki.php,
appending the query string part.
RewriteRule ^([A-Z0-9\xa0-\xff].*)$ /singles/pmwiki.php?n=$1  [QSA,L]

I set up my /website/singles/local/config.php file as follows:

<?php if (!defined('PmWiki')) exit();
## Use "Clean URLs".
$EnablePathInfo = 1;
$ScriptUrl = " http://localhost <http://localhost> ";
## more configuration settings...

<snip>

I believe you want the RewriteBase to be the root as served rather than
the root as stored. Try "RewriteBase /" instead.

Note, the should also allow " http://localhost <http://localhost> "
without the "index.php" to bring up your site.

Also, for this to work your Apache server on the localhost must have
mod_rewrite activated. You might want to check to be sure this is the
case. 

...Eric

<snip>

Eric,

I have exactly the same situation as Tom's description above and I have
the .htaccess file in my root directory. I have followed all the
instructions that I have found (my htaccess file looks exactly the same
as above) and can also confirm that mod_rewrite is also activated for my
Apache install.

However, I cannot get rid of a "?n=" from my URLs. For example, my URLs
read as:

http://hip.eharch.com/?n=Materials/Materials

instead of 

http://hip.eharch.com/Materials/Materials

which I would prefer.

Would you have any ideas or suggestions regarding getting rid of the
"?n=" ?

Thanks. Sameer

 


 


 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: /pipermail/pmwiki-users/attachments/20071204/74b9cf72/attachment-0001.html 


More information about the pmwiki-users mailing list