PDA

View Full Version : Help needed for proper URL redirection


mexabet
01-01-2010, 11:32 AM
I'm having a problem redirecting one URL to another. The following is what I have done:
RewriteEngine on

<Files 403.shtml>
order allow,deny
allow from all
</Files>

RewriteCond %{HTTP_HOST} ^mexabet.org$ [OR]
RewriteCond %{HTTP_HOST} ^www.mexabet.org$
RewriteRule ^policy\/?$ "http\:\/\/www\.mexabet\.org\/policy\/privacy_policy\.php\/" [R=301,L]

The code above adds a forward slash after .php like this:
http://www.mexabet.org/policy/privacy_policy.php/

Can anyone please point me in the right direction?

oesxyl
01-01-2010, 02:56 PM
I'm having a problem redirecting one URL to another. The following is what I have done:
RewriteEngine on

<Files 403.shtml>
order allow,deny
allow from all
</Files>

RewriteCond %{HTTP_HOST} ^mexabet.org$ [OR]
RewriteCond %{HTTP_HOST} ^www.mexabet.org$
RewriteRule ^policy\/?$ "http\:\/\/www\.mexabet\.org\/policy\/privacy_policy\.php\/" [R=301,L]

The code above adds a forward slash after .php like this:
http://www.mexabet.org/policy/privacy_policy.php/

Can anyone please point me in the right direction?
remove the slash, :)

best regards

mexabet
01-01-2010, 03:12 PM
Thanks for your help. Actually the code was generated through cPanel URL Redirect generator, and I'm surprised how it can't get this right.

remove the slash, :)

best regards

oesxyl
01-01-2010, 03:25 PM
Thanks for your help. Actually the code was generated through cPanel URL Redirect generator, and I'm surprised how it can't get this right.
it's a guess but probably they check only few simple things. Some things become complicated when you deal with validation of a form. For example in this case, maybe you redirect to a directory. Since a dot is allowed in both dir and file names checking for extensions '.php' and assuming that is a php file followed by a slash will stop you do add a directory.
In the same time checking for dir or file existence is not relevant since you can first write the redirection and then create the file or dir.
A more complicated form can help with this but probably will add new checking/assumption, :)

best regards

mexabet
01-01-2010, 03:51 PM
Thanks for explaining.

it's a guess but probably they check only few simple things. Some things become complicated when you deal with validation of a form. For example in this case, maybe you redirect to a directory. Since a dot is allowed in both dir and file names checking for extensions '.php' and assuming that is a php file followed by a slash will stop you do add a directory.
In the same time checking for dir or file existence is not relevant since you can first write the redirection and then create the file or dir.
A more complicated form can help with this but probably will add new checking/assumption, :)

best regards