Guru3D.com Forums

Go Back   Guru3D.com Forums > General > Programming/Html
Programming/Html C++,Visual Basic,HTML,Flash,OpenGL,Modelling,Java.


Reply
 
Thread Tools Display Modes
Can Anyone Help with Creating an Alias Using htaccess?
Old
  (#1)
Furious
Newbie
 
Furious's Avatar
 
Videocard: 2x EVGA 285 GTX (SLI)
Processor: Intel i7 965
Mainboard: EVGA 132-BL-E758-A1 X58
Memory: OCZ DDR3 PC3-15000 3x2GB
Soundcard: Auzentech X-Fi Prelude
PSU: ENERMAX REVOLUTION85+1050
Default Can Anyone Help with Creating an Alias Using htaccess? - 01-20-2013, 03:53 | posts: 7 | Location: Hickory, North Carolina

I am hoping to find someone that can help me with setting up an alias using htaccess.
I'd even be happy to make a donation for your time using Paypal.

I know a little about html and css but practically nothing about htaccess files.
After spending 3 frustrating days googling and trying to create an alias using htaccess I am ready for some help.

So here is what I am working with.
I have a Synology network attached storage unit (NAS) that I am hosting from.
The NAS is using Apache to serve up the websites.
Below is my folder structure and URLs to access these folders:

/volume1/web (mydomain.com)
/volume1/web/forums (mydomain.com/forums)
/volume1/web/example/www (mydomain.com/example/www)


What I am wanting to do is to be able to call "mydomain.com/example" and have Apache serve up the contents of "/volume1/web/example/www", or in other words hide the "www" sub-folder from the URL.

Anyone care to take a crack at this before my head explodes from fiddling with it? lol
   
Reply With Quote
 
Old
  (#2)
Furious
Newbie
 
Furious's Avatar
 
Videocard: 2x EVGA 285 GTX (SLI)
Processor: Intel i7 965
Mainboard: EVGA 132-BL-E758-A1 X58
Memory: OCZ DDR3 PC3-15000 3x2GB
Soundcard: Auzentech X-Fi Prelude
PSU: ENERMAX REVOLUTION85+1050
Default 01-22-2013, 17:28 | posts: 7 | Location: Hickory, North Carolina

With a little dumb luck I managed to get this partially working.
I created an .htaccess file in the "/volume1/web/example" folder, inside the .htaccess file I used:

RewriteEngine On
RewriteRule ^(.*)$ /example/www/$1 [L]


Now when I make the URL call "http://mydomain.com/example" it is correctly showing me the index.php page of the "www" folder (/volume1/web/example/www).
Problem now is that all links on this page are adding "/www/" back in the URL.
Example: Clicking on "Login" goes to "http://mydomain.com/example/www/login"

I'll keep poking at it however I feel lucky to have made it this far.
If anyone can be of any help I would greatly appreciate it.
   
Reply With Quote
Old
  (#3)
chanw4
Maha Guru
 
Videocard: ASUS GTX 670 4GB GDDR5
Processor: Intel i7 3770K
Mainboard: ASUS MAXIMUS V EXTREME
Memory: OCZ Platinum DDR3-1600 4G
Soundcard:
PSU: Enermax Platimax 600W
Default 03-26-2013, 05:13 | posts: 2,270 | Location: Hong Kong

I think what you need to do is to create virtual directory for the server not using the REWRITE RULE

EDIT: Nevermind the above answer
What you did in your second post is to redirect all the url that matchs the regex and append it to the end of /example/www/ which im surprise it works when you put http://mydomain.com/example since that will rewrite it to http://mydomain.com/example/www/example

For your situation, i think mod_proxy would be better solution.
ProxyRequests off
ProxyPass /example/ http://mydomain.com/example/www/

You also need an rewrite rule to rewrite the url /example to add the trailing '/' to the url i think. And obviously, you need to load the module in your apache config file. mod_proxy is not loaded by default i think.

http://httpd.apache.org/docs/current...d_rewrite.html

http://httpd.apache.org/docs/2.2/mod/mod_proxy.html



Last edited by chanw4; 03-26-2013 at 05:36.
   
Reply With Quote
Old
  (#4)
Furious
Newbie
 
Furious's Avatar
 
Videocard: 2x EVGA 285 GTX (SLI)
Processor: Intel i7 965
Mainboard: EVGA 132-BL-E758-A1 X58
Memory: OCZ DDR3 PC3-15000 3x2GB
Soundcard: Auzentech X-Fi Prelude
PSU: ENERMAX REVOLUTION85+1050
Default 03-26-2013, 13:28 | posts: 7 | Location: Hickory, North Carolina

Thanks for your reply chanw4.

I guess I forgot to update this post.
I ended up just creating a virtual host in Apache and pointing a sub domain to it, I couldn't figure out any other method.
The only real problem I have using the virtual host is when ever I update the firmware on my NAS (which is what I'm hosting from) I have to re-create the virtual host as it gets deleted.
I may have that problem fixed though, won't know for sure until the next firmware update comes around.
   
Reply With Quote
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Powered by vBulletin®
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
vBulletin Skin developed by: vBStyles.com
Copyright (c) 1995-2014, All Rights Reserved. The Guru of 3D, the Hardware Guru, and 3D Guru are trademarks owned by Hilbert Hagedoorn.