Jump to content

Recommended Posts

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

 

 

Link to comment
https://forums.phpfreaks.com/topic/238355-htaccess-mod-rewrite/
Share on other sites

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

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,

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/.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.