Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Rewrite condition without RewriteCond ?

Status
Not open for further replies.

sergiozambrano

Technical User
Oct 6, 2011
1
0
0
US
I wrote a regex for a rewrite rule that includes a negative lookahead to replace the rewriteCond line, because WordPress only accepts two values: pattern -> substitution.

It should find findme.html _here, regardless of where it's requested to be:
mydomain.com/_here/findme.html
e.g.

(Sorry, I can't modify the swf which will request findme.html in the wrong places)

So, given findme.html could be requested to be in, e.g.:

mydomain.com/findme.html
mydomain.com/directory/findme.html
mydomain.com/directory/findme.html?someparam=3

The rewrite should make them all

mydomain.com/_here/findme.html

So, I made a rewrite rule that Wordpress will accept, with a negative lookahead so it only matches URLs which dont contain "_here/" already, as follow

Code:
Options +FollowSymlinks
RewriteEngine On
RewriteRule ^.*?(?!_here/)findme\.html$ /_here/findme.html [R=301,L]

The problem is IT DOES loop.

What did I miss?

(I tested it with no other code in the .htaccess file, still looping)
 
Try this:

RewriteRule ^.*?!(_here/)findme\.html$ /_here/findme.html [R=301,L]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top