Forum Moderators: phranque

Message Too Old, No Replies

Rewriterule to virtual folder is not working

         

agriz

10:34 am on Jun 22, 2009 (gmt 0)

10+ Year Member



Hi,

*) RewriteRule ^betisier\.php$ page.php [L] (This is working for me)

*) RewriteRule ^onenparle/presse\.php$ onenparle.php [L] (This is not working for me)

onenparle is a folder which is not exist in my server.
In top of my htaccess, I have added these two lines. This htaccess is written in the subfolder (tdm)

RewriteEngine on
RewriteBase /tdm

Please let know why the second rewriterule is not working...

Thanks
Agriz

jdMorgan

2:25 pm on Jun 22, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



What are the full requested URLs? (both will need to start with "/tdm" for this to work, and both 'real' php scripts must reside in the /tdm directory as well.)

Also, be aware that you should completely flush (or delete) your browser cache after making any changes to your server-side configuration code.

Jim

agriz

11:27 am on Jun 26, 2009 (gmt 0)

10+ Year Member



Hi Jim,

Thanks for your reply. I was out of station. I am unable to check my mails.

1) Scripts are inside tdm folder.
2) Below are the examples which i tried:

*)RewriteRule ^tdm/onenparle/presse\.php$ tdm/onenparle.php
[L]
*)RewriteRule ^/tdm/onenparle/presse\.php$ /tdm/onenparle.php [L]
*)RewriteRule ^/onenparle/presse\.php$ /onenparle.php [L]

Even i tried to give full path. It is not working :-(

SOMETHING DIFFERENT I TRIED:
-----------------------------
*) I created a new folder in the name of onenparle. Then this htaccess code works! But normally it should work without this folder ?!?

*) onenparle.php is the only file which exist in my server (tdm folder)

Is this problem because of the same name of folder name and file name? (I am not really good in htaccess.)

Thanks
Agriz

agriz

11:29 am on Jun 26, 2009 (gmt 0)

10+ Year Member



RewriteRule ^onenparle1/presse\.php$ onenparle.php [L]

This is also working.

But,
RewriteRule ^onenparle/presse\.php$ onenparle.php [L]
this is not working!

jdMorgan

2:04 pm on Jun 26, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



In /tdm/.htaccess:

Options +FollowSymLinks -MultiViews
RewriteEngine on
#
RewriteRule ^betisier\.php$ page.php [L]
RewriteRule ^onenparle/presse\.php$ onenparle.php [L]

Now request the following URLs:
example.com/tdm/betisier\.php
example.com/tdm/onenparle/presse\.php

The first will be rewritten to example.com/page.php
The 2nd will be rewritten to example.com/onenparle.php

RewriteBase is probably not needed, unless your server is not configured normally.

Jim

agriz

2:12 pm on Jun 26, 2009 (gmt 0)

10+ Year Member



Thanks for this reply Jim.

I will check and let you know in few minutes

Thanks
Agriz

agriz

2:29 pm on Jun 26, 2009 (gmt 0)

10+ Year Member



It is working :-)

Thanks for your help Jim..

Can you tell me what does the following line mean?
Options +FollowSymLinks -MultiViews

Thanks
Agriz

jdMorgan

3:37 pm on Jun 26, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



See Apache directives "core" documentation, "Options" directive.

This Options line enables FollowSymLinks, which is required by mod_rewrite (see mod_rewrite documentation) and it disables MultiViews (content-negotiation), which can otherwise interfere with mod_rewrite when the requested URL does not resolve to an existing file (See Apache mod_negotiation docs).

Jim