tag:blogger.com,1999:blog-865923359735383241.post6907628101957487270..comments2023-10-29T07:27:09.012-06:00Comments on Ccna final exam - java, php, javascript, ios, cshap all in one: How do I ignore a directory in mod_rewrite?Unknownnoreply@blogger.comBlogger8125tag:blogger.com,1999:blog-865923359735383241.post-45553254500551498852012-05-31T19:29:30.011-06:002012-05-31T19:29:30.011-06:00This is a really annoying stupid bug, I have been ...This is a really annoying stupid bug, I have been searching the web for ages finally come accross tis post and still nothing works :s<br /><br />Might be worth also pointing this here...<br />http://www.addedbytes.com/blog/ignore-directories-in-mod-rewrite/Userhttps://www.blogger.com/profile/11557173689529910046noreply@blogger.comtag:blogger.com,1999:blog-865923359735383241.post-33350836472069008692012-05-31T19:29:28.623-06:002012-05-31T19:29:28.623-06:00I’ve had the same issue using wordpress and found ...I’ve had the same issue using wordpress and found that the issue is linked with not having proper handler for 401 and 403 errors..<br /><br />RewriteCond %{REQUEST_FILENAME} !-f<br />RewriteCond %{REQUEST_FILENAME} !-d<br /><br /><br />These conditions are already supposed not to rewrite the url of existing folders but they don’t do their job for password protected folders. In my case, adding the following two lines to my root .htaccess fixed the problem:<br /><br />ErrorDocument 401 /misc/myerror.html<br />ErrorDocument 403 /misc/myerror.html<br /><br /><br />Of course you need to create the /misc/myerror.html,Userhttps://www.blogger.com/profile/11557173689529910046noreply@blogger.comtag:blogger.com,1999:blog-865923359735383241.post-16682840459361981282012-05-31T19:29:27.450-06:002012-05-31T19:29:27.450-06:00I'm not sure if I understand your objective, b...I'm not sure if I understand your objective, but the following might do what you're after?<br /><br />RewriteRule ^/vip/(.*)$ /$1?%{QUERY_STRING} [L]<br /><br /><br />This will cause a URL such as http://www.example.com/vip/fred.html to be rewritten without the /vip.Userhttps://www.blogger.com/profile/11557173689529910046noreply@blogger.comtag:blogger.com,1999:blog-865923359735383241.post-63809467654239166022012-05-31T19:29:26.676-06:002012-05-31T19:29:26.676-06:00This works ...
RewriteRule ^vip - [L,NC]
But en...This works ...<br /><br />RewriteRule ^vip - [L,NC]<br /><br /><br />But ensure it is the first rule after <br /><br />RewriteEngine on<br /><br />i.e. <br /><br />ErrorDocument 404 /page-not-found.html<br /><br />RewriteEngine on<br /><br />RewriteRule ^vip - [L,NC]<br /><br />AddType application/x-httpd-php .html .htm<br /><br />RewriteCond %{REQUEST_FILENAME} !-f<br />RewriteCond %{REQUEST_FILENAME} !-d <br /><br />etcUserhttps://www.blogger.com/profile/11557173689529910046noreply@blogger.comtag:blogger.com,1999:blog-865923359735383241.post-24035161307834027842012-05-31T19:29:25.201-06:002012-05-31T19:29:25.201-06:00In summary, the final solution is:
ErrorDocument ...In summary, the final solution is:<br /><br />ErrorDocument 401 /misc/myerror.html<br />ErrorDocument 403 /misc/myerror.html<br /><br /># BEGIN WordPress<br /><IfModule mod_rewrite.c><br />RewriteEngine On<br />RewriteBase /<br />RewriteCond %{REQUEST_FILENAME} !-f<br />RewriteCond %{REQUEST_FILENAME} !-d<br />RewriteRule . /index.php [L]<br /></IfModule><br /><br /># END WordPress<br /><br /><br />I posted more about the cause of this problem in my specific situation, involving Wordpress and WebDAV on Dreamhost, which I expect many others to be having on my site.Userhttps://www.blogger.com/profile/11557173689529910046noreply@blogger.comtag:blogger.com,1999:blog-865923359735383241.post-12274867696535059952012-05-31T19:29:24.055-06:002012-05-31T19:29:24.055-06:00You mentioned you already have a .htaccess file in...You mentioned you already have a .htaccess file in the directory you want to ignore - you can use <br /><br />RewriteEngine off<br /><br /><br />In that .htaccess to stop use of mod_rewrite (not sure if you're using mod_rewrite in that folder, if you are then that won't help since you can't turn it off).Userhttps://www.blogger.com/profile/11557173689529910046noreply@blogger.comtag:blogger.com,1999:blog-865923359735383241.post-69918672090410587042012-05-31T19:29:22.801-06:002012-05-31T19:29:22.801-06:00RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{...RewriteCond %{REQUEST_FILENAME} !-f<br />RewriteCond %{REQUEST_FILENAME} !-d<br /><br /><br />This says if it's an existing file or a directory don't touch it. You should be able to access site.com/vip and no rewrite rule should take place.Userhttps://www.blogger.com/profile/11557173689529910046noreply@blogger.comtag:blogger.com,1999:blog-865923359735383241.post-53441141034046370082012-05-31T19:29:21.573-06:002012-05-31T19:29:21.573-06:00Try putting this before any other rules.
RewriteR...Try putting this before any other rules.<br /><br />RewriteRule ^vip - [L,NC]<br /><br /><br />It will match any URI beginning vip. <br /><br /><br />The - means do nothing. <br />The L means this should be last rule; ignore everything following. <br />The NC means no-case (so "VIP" is also matched).<br /><br /><br />Note that it matches anything beginning vip. The expression ^vip$ would match vip but not vip/ or vip/index.html. The $ may have been your downfall. If you really want to do it right, you might want to go with ^vip(/|$) so you don't match vip-page.htmlUserhttps://www.blogger.com/profile/11557173689529910046noreply@blogger.com