Koozali.org: home of the SME Server

Help Request - mod_rewrite (remove index.php from path)

Offline rmucb

  • 2
  • +0/-0
Help Request - mod_rewrite (remove index.php from path)
« on: January 07, 2009, 11:53:47 AM »
Hey All,

Been a long time since I posted here (so long in fact that I needed to re-register).

Anyhow, I was helping with a server implementation recently, and there was
something I was looking for some help with.

I have looked all through the forums, but I don't think I have been using the
correct search terms.  All the info that I have found pointed me in a direction,
but I have not been able to get this to work.

I have a CMS application installed to a dedicated ibay (not the Primary).
The system itself is working correctly, no problems with the out of box config.

However, I am running into the following issue:

When a page request is made with this cms, the pages requested are served as follows:
http://<domainname>/index.php/page_name.html

It is desired for these requests to be rewritten as:
http://<domainname>/page_name.html

Basically, rewriting the request to remove the "index.php" from the path.

The cms already supports the use of the the mod_rewrite module, however
I have been unable to get the rule to work correctly.

I have tried a few handful of different methods using what I have found here
and elsewhere on the internet.

The closest I have been able to get, when implementing the change, is typically
either an "access forbidden" message or it does not work at all.

I think I am implementing the rule incorrectly, when trying to create the custom template.

Can anyone please help with making this change?  It would be greatly appreciated.
If more info is required I will gladly supply.

Thanks in advance!


Offline cactus

  • *
  • 4,880
  • +3/-0
    • http://www.snetram.nl
Re: Help Request - mod_rewrite (remove index.php from path)
« Reply #1 on: January 07, 2009, 06:58:14 PM »
The closest I have been able to get, when implementing the change, is typically
either an "access forbidden" message or it does not work at all.

I think I am implementing the rule incorrectly, when trying to create the custom template.

Can anyone please help with making this change?  It would be greatly appreciated.
If more info is required I will gladly supply.

Thanks in advance!
What is the rule you have designed? Posting it might help us in trying to spot where things might go wrong. Did you have a look at the logfiles as well to see what the server thought it needed to do when things where configured but not working?

I am thinking it should be something like this (although I did not test anything):

Code: [Select]
RewriteRule ^/index.html/(.*|$)    http://%{HTTP_HOST}/$1 [L,R]
Be careful whose advice you buy, but be patient with those who supply it. Advice is a form of nostalgia, dispensing it is a way of fishing the past from the disposal, wiping it off, painting over the ugly parts and recycling it for more than its worth ~ Baz Luhrmann - Everybody's Free (To Wear Sunscreen)

Offline rmucb

  • 2
  • +0/-0
Re: Help Request - mod_rewrite (remove index.php from path)
« Reply #2 on: January 16, 2009, 09:14:21 PM »
@Cactus

Thanks for the reply.  Thought my original post broke the site as went down
almost immediately after!  Good job with getting things back on track.

Here is some additional info:

I had forgotten to mention that the CMS had been installed to its own ibay
that had been setup to run as a virtual host.

The primary mod_rewrite rule that I had been attempting to use
(and some slightly different varients) is as follows:

Code: [Select]

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


I think the problem lies with how to get this working within the httpd.conf.

I know that custom templates are suppose to be used, but the part that
escapes me the correct implemention.

Additionally, would I almost need to implement a Follow Symlinks or a
ReWriteEngine On command?

Your help is greatly appreciated.

Thanks!

Offline byte

  • *
  • 2,183
  • +2/-0
Re: Help Request - mod_rewrite (remove index.php from path)
« Reply #3 on: January 16, 2009, 10:38:20 PM »
Moving this topic to the General Discussion forum, it is more appropriate there. Thanks!
--[byte]--

Have you filled in a Bug Report over @ http://bugs.contribs.org ? Please don't wait to be told this way you help us to help you/others - Thanks!