homepage Welcome to WebmasterWorld Guest from 54.197.211.197
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

    
need to bypass wordpress htaccess for scripts in subdirectory
tried everything I can think of
mikiowoko

5+ Year Member



 
Msg#: 4568065 posted 9:33 pm on Apr 25, 2013 (gmt 0)

I need an htaccess guru

trying to bypass wordpress htaccess for scripts within a subdirectory (symbolic link off wordpress root)

I have wordpress installed on hostgator shared
public_html/onedomain.com
and a redirect script in
public_html/redirect

there's a symbolic link
public_html/onedomain.com/redirect

that works just fine until the wordpress permalink entries break it

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
</IfModule>


I've tried just about every variation of

RewriteRule redirect/(.*)$ - [L]
or
RewriteCond %{REQUEST_FILENAME} !-l
and
RewriteCond %{REQUEST_FILENAME} -l

I can think of and can't find a solution.

 

lucy24

WebmasterWorld Senior Member lucy24 us a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month



 
Msg#: 4568065 posted 6:36 am on Apr 26, 2013 (gmt 0)

Never mind links and scripts and bypassing. In English: what are you physically trying to do?

What, if any, are your current RewriteOptions settings? Everything is off by default, but if you're on shared hosting your host may have something in the config file. This is worth checking, because mod_rewrite unlike almost everything else in Apache does not inherit by default. So putting a second set of rewrite directives in a subdirectory is often enough to kill any rewrites created in the main directory. (If this sounds confusing, it is.)

mikiowoko

5+ Year Member



 
Msg#: 4568065 posted 8:17 am on Apr 26, 2013 (gmt 0)

I'm trying to add a rule that says "if the request if for something in redirect let it go and ignore the rules that follow

like in the wordpress standard ruleset

RewriteBase /
RewriteRule ^index\.php$ - [L] #this rule says if the request if for index.php, deliver whatever index.php has
RewriteRule test for /something in my subdirectory - [L] #deliver what's in there
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

phranque

WebmasterWorld Administrator phranque us a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



 
Msg#: 4568065 posted 1:59 pm on Apr 27, 2013 (gmt 0)

instead of that RewriteRule you need a RewriteCond that excludes uri paths beginning with redirect.

lucy24

WebmasterWorld Senior Member lucy24 us a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month



 
Msg#: 4568065 posted 9:28 pm on Apr 27, 2013 (gmt 0)

... and put this RewriteCond before the ones that check for -f and -d.

But if you don't want any further rewriting to happen, ever, to requests for the /redirect/ directory, you can perfectly well put it into the same rule that convers /index.php:

RewriteRule ^(redirect/|index\.php$) - [L]

Note position of slashes and anchors.

mikiowoko

5+ Year Member



 
Msg#: 4568065 posted 6:54 pm on Apr 28, 2013 (gmt 0)

I've tried just about everything I can think of, and all fails, it only works if I comment out all the WordPress rules.
RewriteRule ^(redirect/|index\.php$) - [L]
RewriteRule ^(/redirect/|index\.php$) - [L]
RewriteRule ^(redirect/.*|index\.php$) - [L]
RewriteRule ^(/redirect/.*|index\.php$) - [L]

lucy24

WebmasterWorld Senior Member lucy24 us a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month



 
Msg#: 4568065 posted 9:00 pm on Apr 28, 2013 (gmt 0)

Note position of slashes and anchors.

You are either in htaccess, or not in htaccess. If it's shared hosting, it is definitely htaccess. If it's your own server, you know best. If you are not capturing and there is no closing anchor, a trailing .* is never necessary.

it only works if I comment out all the WordPress rules

Uh-oh. Half of the rules should always fail. Which half depends on where you are.

But "where you are" is the crucial question here. Not just what file, but where in file. Your RewriteRules need to be in the correct location relative to the rules that WordPress has put in place. Within each individual module, rules execute from top to bottom.

The rule you're currently trying out-- the one with two pipe-delimited options-- is intended to replace the existing rule that only names "index\.php$". If it's located anywhere else, it will have undesired consequences. Fancy way of saying "won't work".

mikiowoko

5+ Year Member



 
Msg#: 4568065 posted 11:13 pm on Apr 29, 2013 (gmt 0)

I'm in shared hostgator.
Is there a way to tell it "If redirect let redirect have it"?

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved