Dynadot .com transfer sale, only $10.12 with coupon code DYNA12, available while supplies last, ends October 31, 2026.

Accesing a file in an upper directory thread

Namecheap AuctionsNamecheap Auctions
NamecheapNamecheap
SpaceshipSpaceship
Watch
Accesing a file in an upper directory

I am trying to access the .htaccess file from another folder, so for example from the admin folder i want to edit the root .htaccess file.
PHP:
$current = file_get_contents('../.htaccess');
$current .= "\n RewriteRule ^". $url ." show.php?id=". $id;
$h = fopen('../.htaccess', 'w+');
fwrite($h, $current, filesize('../.htaccess'));


I have this but it doesn't seem to work.
 
Last edited:
0
Close
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
Well your fopen only has one . if you are trying to access from like
/blah/
Where your script is in
/blah/blahs2/

Or are you trying to access where your script is
/blah/
And your .htaccess is in
/blah/blahs/

??

- Steve
 
0
Close
first one.

The file is in /blah/
and script is in
/blah/blahs2/
 
0
Close
.htaccess does not generally have the proper premissions to be edited. You will need to use ftp and php in order to do it.

http://php.net/ftp

Good luck.. I will let you try first before giving you the code for it..

- Steve
 
0
Close
CatchedCatched

We're social

Escrow.com
Spaceship
CryptoExchange.com
Domain Recover

NamePros updates

Quick replies: search, your most used replies, and more on every post
Quick replies are easier to find and use now. The quick reply menu has a search box. Type a few letters to find the reply you want. A...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back