Destramic Posted June 3, 2011 Share Posted June 3, 2011 hey i want to be able to re write an uri with mod rewrite in the .htaccess file. my directory looks like so: -www /public /scripts .htacess and my files are located in the /public file and to access the url would look like http://domin.com but what i want to do is create a re mod rewrite so when http://domin.com/~scripts is access it will take me out of the /public directory and access /scripts directory (../scripts) can someone help me on how this can be done please...thank you Quote Link to comment Share on other sites More sharing options...
requinix Posted June 4, 2011 Share Posted June 4, 2011 You don't actually need mod_rewrite. Assuming you're on a Linux server you can just put in a symlink. From a shell, /path/to/yourfiles $ ln -s scripts 'public/~scripts' You may need to modify your .htaccess with Options +FollowSymLinks Quote Link to comment Share on other sites More sharing options...
Destramic Posted June 4, 2011 Author Share Posted June 4, 2011 thanks for your reply...im still trying to work it out...would i also put this code in the .htacess file? /path/to/yourfiles $ ln -s scripts 'public/~scripts' Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted June 4, 2011 Share Posted June 4, 2011 No that code is to be used in a command shell for defining the symlink. You first need to open a command terminal move to the directory where you want the symlink and then run the command requinix suggested. Next add Options +FollowSymLinks to a .htaccess file in the public/ directory, Quote Link to comment Share on other sites More sharing options...
Destramic Posted June 4, 2011 Author Share Posted June 4, 2011 ok well im new to shell commands and i have to say im a bit stuck on how to do this...bear in mind im using apache 2.2 from a windows OS do i need to execute the command with shell_exec()? Quote Link to comment Share on other sites More sharing options...
requinix Posted June 4, 2011 Share Posted June 4, 2011 Oh, Windows... What version? And is this the computer where the web site is hosted, or is it just your development machine? Quote Link to comment Share on other sites More sharing options...
Destramic Posted June 6, 2011 Author Share Posted June 6, 2011 Sorry about the delay...yes it's just a development machine and only used for just that purpose...but at the moment i'm just using xp...and i'm just viewing the site on localhost Quote Link to comment Share on other sites More sharing options...
requinix Posted June 6, 2011 Share Posted June 6, 2011 In Windows, on NTFS drives, you can create hardlinks. Basically, the two directories (scripts and public/~scripts) point to the same location on the hard drive: same files, same dates and times, different parent directories. Find the Command Prompt in the Start menu (check Accessories), right-click, Run as administrator. Then find the directory that contains scripts/ and public, shift+right-click, Copy as path. Back in the command prompt, type cd /d (now right-click in the window and hit Paste) fsutil hardlink create public/~scripts scripts For the real server, if it's running Linux, get whoever maintains it to create the symlink I mentioned: from public/~scripts to scripts/. Quote Link to comment Share on other sites More sharing options...
Destramic Posted June 7, 2011 Author Share Posted June 7, 2011 after a long stuggle i admit defeat...it comes back saying Error. Access is denied. but i have logged in as administrator as you've said...help please Quote Link to comment Share on other sites More sharing options...
requinix Posted June 8, 2011 Share Posted June 8, 2011 Then it'll probably be easier to have two sets of files on your machine. So why do you need these two folders anyways? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.