Simple url rewriting

New to mod_rewrite? This is a good place to start.

Simple url rewriting

Postby vineld » Wed Aug 27, 2003 11:31 am

Hello,

I am having a bit of a problem with mod_rewrite. Being a beginner I don't quite know what I am doing wrong. I want to rewrite files like this:

original url:
http://www.domain.com/directory/file.html

this I want to go to:
http://www.domain.com/directory/goto.ph ... =file.html



This is what I tried:

RewriteEngine on
Options +FollowSymLinks

RewriteRule ^(.*?)directory(.*)$ $1goto.php?information=$2 [L]



I keep getting a 403 message, what am I doing wrong?


All the best,

Vincent
vineld
 
Posts: 3
Joined: Wed Aug 27, 2003 11:27 am

Postby Guest » Thu Aug 28, 2003 2:31 am

Your rule is not written correctly.
I'm a beginner with this myself, but try:

RewriteEngine on

RewriteRule ^/directory/(.*) /directory/goto.php?information=$1 [L]


or try

RewriteEngine on

RewriteRule ^/(.*)/(.*) /$1/goto.php?information=$2 [L]
Guest
 

Postby vineld » Fri Dec 05, 2003 1:32 pm

Thanks for the help but it doesn't work still, all I get is a 403 Forbidden message:

"You don't have permission to access /directory/file.html on this server."
vineld
 
Posts: 3
Joined: Wed Aug 27, 2003 11:27 am

more detail

Postby Guest » Sat Jan 03, 2004 5:44 am

I think

http://www.domain.com/directory/goto.ph ... =file.html

then somehow becomes

http://www.domain.com/directory/goto.ph ... =file.html

then any url after that %3f will lead to 403 forbidden erroor. Is this php parsing error?

Hopefully, next person will be able to solve it.
Guest
 

Postby vineld » Sat Jan 03, 2004 8:27 am

Yeah, I have almost given up on it now...
vineld
 
Posts: 3
Joined: Wed Aug 27, 2003 11:27 am

Postby Guest » Fri Jan 09, 2004 8:03 pm



How about:

Code: Select all
RewriteRule ^directory/(.*)$ directory/goto.php?information=$1 [QSA]


Not sure if that will work, but you don't need all the http://www..../ in front of it.
Guest
 


Return to Beginner's Corner

Who is online

Users browsing this forum: No registered users and 46 guests

cron