Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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.

share|improve this question

3 Answers 3

up vote 1 down vote accepted

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.

share|improve this answer

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)

share|improve this answer

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.