Page 1 of 1

mod_rewrite problems

Posted: Tue Jul 22, 2008 12:54 pm
by caedo
Good day,


Im using mod_rewrite to redirect users to existing pages from fake, user friendly pages.
The problem that Im having is that when Im redirected to the page, the url changes to the one of the existing page.

Here is my .htaccess code:

Code: Select all

 
DirectoryIndex index.php
 
RewriteEngine On
Options +FollowSymlinks
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule  ^(.+)/(.+).htm$ http://mydomain.com/front-ctrl.php?url=%{http_host}&cat=$1&page=$2[L]
 
 

So, the issue is, how can I maintain the fake, user-friendly instead of being redirect to the real url?

thanks in advance.

caedo.

Re: mod_rewrite problems

Posted: Tue Jul 22, 2008 1:32 pm
by Zoxive
caedo wrote: So, the issue is, how can I maintain the fake, user-friendly instead of being redirect to the real url?

thanks in advance.

caedo.
Most likely it is because you could be redirecting to a different domain. As long as its the same domain it should not hard redirect.

Re: mod_rewrite problems

Posted: Tue Jul 22, 2008 3:02 pm
by caedo
Mmmmm....that makes sense. Doing tests using the same domain, there wasnt any problem(but it didnt show me the right content), as soon as I change the domain, all went wrong. Now the problem is, how can I access that script if it isnt in the domain's directory?

The file structure goes like this:

/ <-- mydomain.com // Here is where I access the front-ctrl.php script
/dir1
/dir2
front-ctrl.php
/domain <-- this is the domain I use
.htaccess


I want to access the front-ctrl.php from the /domain. Is the a way to do it?