2

I have the following line in my .htaccess file, but it keeps redirecting me to a 404 error.

RewriteRule ^path1/([a-zA-Z0-9_-]+)/(.+)(/?)$ /file.php?variable1=$1&variable2=$2 [nc]

An example link would be..

http://domain.com/path1/name23/http://domain2.com/stuff/is/here

I want to turn transfer that 2nd URL to variable2.

3 Answers 3

1

RewriteRule ^path1/([a-z0-9_-]+)/([^\?]+)$ /file.php?variable1=$1&variable2=$2 [NC]

Try the above rule and see. Your pattern is not matching that why you get the 404 error. By the way, I remove A-Z because NC will make it case-insensitive anyway.

0

I think that with only [NC] apache is looking for a file called 'file.php?variable1=$1&variable2=$2' (with variable subsitued) on the hard drive. You can try with [R,NC] or [PT,NC] (this one need mod_proxy)

0

Increase log level to Debug and see that mod_rewrite is doing.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .