I think this will work from your root folder and be recursive, but I have in the past used something similar for protection in folders farther down the line:
# add to /portfolio/ folder
## 0ption: set permissions to 0404
# Whitelist all portfolio files
SetEnvIf Request_URI "/portfolio/(.*).php$" whitelist
# Whitelist ONLY one or more specific files
#SetEnvIf Request_URI "/portfolio/filename.php$" whitelist
#SetEnvIf Request_URI "/portfolio/filename.php$" whitelist
#SetEnvIf Request_URI "/portfolio/filename.php$" whitelist
#SetEnvIf Request_URI "/portfolio/filename.php$" whitelist
#SetEnvIf Request_URI "/portfolio/filename.php$" whitelist
<FilesMatch "\.(php)$">
Order Deny,Allow
Allow from env=whitelist
Deny from all
</FilesMatch>
<Files ~ ".*\..*">
order allow,deny
deny from all
</Files>
<Files *.php>
deny from all
</Files>
note: No guarantees of any kind here, just trying to be helpful!
Thread Starter
Jay
(@the_circle_pit)
Thanks for your reply, before your reply I tried to use a Rewrite Rule in my .htaccess of root dir. Which worked for me.
Below is the rule:
RewriteRule ^portfolio/ https://www.thecirclepit.com [R=301,L]
It worked, but It also place the http://www.website.com in front of the links in the items execepts of those portfolio items.
So now all the links are
http://www.website.com/http://www.website.com/tag/example
and
http://www.website.com/www.facebook.com
Any idea if there a way to remove the first section(http://www.website.com/) of those URL’s?
I have only ever seen that once, and it was related to a 404 that was of no concern. So, I only know there must be a way and that here is where I would begin looking and trying to learn more:
http://perishablepress.com/stupid-htaccess-tricks/
http://corz.org/server/tricks/htaccess.php
Thread Starter
Jay
(@the_circle_pit)
The rewrite rule i used [R=301] is a Redirect and the 301 means Moved Permanently. Thats why there would be a 404 error. There has to be an easy way to undo this…
[R] = instructs Apache to issue a redirect, causing the browser to request the rewritten/modified URL.
Thread Starter
Jay
(@the_circle_pit)
I ended up doing this…
RedirectMatch 302 /portfolio/(.*) http://www.web.com/?s=$1
Redirect 302 /portfolio http://www.web.com/
Than change the 302 to 301 after testing.
Also the ?s= from the first line is how my search works so it places any item that is typed after the /portfolio/ into a search for my site.