/    Sign up×
Community /Pin to ProfileBookmark

.htaccess allow access to only one file

Hi guys..
I want to embed client side server files (like .js .css) and anything else (images, pdf files …) with php fopen function..

First of all, is this a good idea ( for load time, bandwith, SEO, etc) ?

Secondy, i want to make this rewriterules rules:

1) DirectoryIndex php/index.php
2) [url]http://www.bla-bla.com/cat1[/url] –> [url]http://www.bla-bla.com/php/index.php?cat=cat1[/url]
3) [url]http://www.bla-bla.com/cat1/subcat1[/url] –> [url]http://www.bla-bla.com/php/index.php?cat=cat1&subcat=subcat1[/url]
4) [url]http://www.bla-bla.com/cat1/subcat1/article1[/url] –> [url]http://www.bla-bla.com/php/index.php?cat=cat1&subcat=subcat1&article=article1[/url]
5) [url]http://www.bla-bla.com/cat1/subcat1/article1/info1[/url] –> [url]http://www.bla-bla.com/php/index.php?cat=cat1&subcat=subcat1&article=article1&info=info1[/url]
6) Deny Access To Everyone Except PHP fopen to all files except php/index.php [B](only with the above ways)[/B]
7) Redirect all request that deny from 6) to [url]http://www.bla-bla.com/php/index.php?error=404[/url] with a 404 error flag (SEO friendly if possible)

Is all of this conditions possible?
Any help?

to post a comment
PHP

0Be the first to comment 😎

×

Success!

Help @el07694 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.15,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...