.htaccess issue
Posted by: rkjgsw (---.chep.com)
Date: August 26, 2010 04:55PM

Hi all,

I need your help. I am working locally on a project using WAMP, this is a modular website coded in HTML and PHP. The problem is that I would like to change from dynamic URL to friendly ones using “.htaccess”. I already enable the rewrite mode on httpd.conf, but still it (.htaccess) does not work as it should, even though I have tried different ways.

On “www” I have placed the project folder and in the root directory of this one lives the .htaccess file.

I just tried the rewrite mode with the following url:

[localhost]

The result should be something like this:

[localhost]


Here the .htaccess file:

Options +FollowSymLinks
RewriteEngine on
RewriteRule index/page/(.*)/ index.php?page=$1
RewriteRule index/page/(.*) index.php?page=$1

I just can not see what’s going wrong!
Maybe the .htaccess?
Could you please help me out?

Any help will be very much appreciating.
If you need some more info just let me know

Cheers
rkjgsw

Options: ReplyQuote
Re: .htaccess issue
Posted by: c2dan (---.15-1.cable.virginmedia.com)
Date: August 26, 2010 07:43PM

You need to go

[localhost]

mod_rewrite will not automatically convert your existing urls to the new format url. You'll have to modify your existing urls to the new format.

Options: ReplyQuote
Re: .htaccess issue
Posted by: rkjgsw (89.129.218.---)
Date: August 26, 2010 08:47PM

hi, , I have modified the urls e.g:

<ul>
<li><a href="/index/page/itemone/">ITEMONE</a></li>
</ul>

but it does not work, instead i got this:

Not Found

The requested URL /index/page/hostales/ was not found on this server.


:-(

thanks c2dan

Options: ReplyQuote
Re: .htaccess issue
Posted by: yfastud (Moderator)
Date: August 26, 2010 09:59PM


Options: ReplyQuote
Re: .htaccess issue
Posted by: rkjgsw (89.129.218.---)
Date: August 26, 2010 10:15PM

it does work when adding localhost/myproject/
but the entire url looks like it
htt://localhost/myproject/localhost/myproject/index/page/itemone/

it seems as it adds that path again at the end

:-(

thanks for helping me

Options: ReplyQuote
Re: .htaccess issue
Posted by: toumimi (---.44.75-86.rev.gaoland.net)
Date: August 26, 2010 11:02PM

It's normal, it's a relative path if you don't use "/".
You should always use complete url in your links.

<li><a href="http:/ /localhost/myproject/index/page/itemone/">ITEMONE</a></li>

A function which generate your rewrited urls should be useful !
Even for adding the right server name, when moving your project.

But for now, you have to call this url directly in your browser and play with your regexp in .htaccess to make the redirection working.
Be careful because ".*" catch "/" as well so you may be surprised at a moment...

Florian

WampServer Patch (Screenshots)
Topic EN : www.wampserver.com
Topic FR : www.wampserver.com

Options: ReplyQuote
Re: .htaccess issue
Posted by: rkjgsw (89.129.218.---)
Date: August 28, 2010 12:41PM

hi,

I got this working now, nice URLs!!! Great!!!

But still I got one problem when linking the *.css file for styling...it just does not work.

How do I have to link it? Do I have to do something in the .htaccess?

many thanks

.....

This *.css issue is now fixed just added on .htaccess:

RewriteBase /myproject/

and

<link rel="stylesheet" type="text/css" href="[localhost];

on HTML

it all works now!!!

just wanted to thank you all!!

you are awesome!!!


cheers



Edited 1 time(s). Last edit at 08/28/2010 09:38PM by rkjgsw.

Options: ReplyQuote


Sorry, only registered users may post in this forum.