Apache Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsSystem AdministrationApache Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old September 15th, 2012, 03:10 PM
Wayniac Wayniac is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2009
Posts: 50 Wayniac New User: is a brand new recruit and a unknown entity at this point. 
Time spent in forums: 12 h 7 m 53 sec
Reputation Power: 0
Mod_rewrite assistance

Hello everyone,

mod_rewrite is enabled and working.

Joomla is installed under "example.com/_usr/example1". What I would like to achieve is to never have the public see "_usr/example1" anymore, so just "example.com" and of course any trailing pages that I create in the future.

End result = Removal of "_usr/example1".

I tried the following code, but it never worked and I'm sure I'm far off from the solution.

RewriteEngine On
Options +FollowSymLinks
RewriteRule ^_usr/example1/ http://example.com/? [R=301,L]

Any assistance would be greatly appreciated!

Reply With Quote
  #2  
Old September 15th, 2012, 04:33 PM
requinix's Avatar
requinix requinix is offline
Still alive
Dev Shed God 16th Plane (12500 - 12999 posts)
 
Join Date: Mar 2007
Location: Washington, USA
Posts: 12,861 requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)  Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 5 Months 1 Week 5 Days 5 h 45 m 49 sec
Reputation Power: 8977
Send a message via AIM to requinix Send a message via MSN to requinix Send a message via Yahoo to requinix Send a message via Google Talk to requinix
Can't you just change the virtualhost (or regular host) to use that as the document root instead?

Reply With Quote
  #3  
Old September 15th, 2012, 04:40 PM
Wayniac Wayniac is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2009
Posts: 50 Wayniac New User: is a brand new recruit and a unknown entity at this point. 
Time spent in forums: 12 h 7 m 53 sec
Reputation Power: 0
Good question, but no unfortunately. I am able to do it for all except this one as this one is the main host.

Reply With Quote
  #4  
Old September 15th, 2012, 08:48 PM
requinix's Avatar
requinix requinix is offline
Still alive
Dev Shed God 16th Plane (12500 - 12999 posts)
 
Join Date: Mar 2007
Location: Washington, USA
Posts: 12,861 requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)  Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 5 Months 1 Week 5 Days 5 h 45 m 49 sec
Reputation Power: 8977
Send a message via AIM to requinix Send a message via MSN to requinix Send a message via Yahoo to requinix Send a message via Google Talk to requinix
Have it rewrite everything into that directory (except for stuff actually in that directory); what you have now tries to rewrite out of it.
Code:
RewriteRule ^(?!_usr/example1) _usr/example1${REQUEST_URI} [L]

Reply With Quote
  #5  
Old September 16th, 2012, 11:33 AM
Wayniac Wayniac is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2009
Posts: 50 Wayniac New User: is a brand new recruit and a unknown entity at this point. 
Time spent in forums: 12 h 7 m 53 sec
Reputation Power: 0
No go sorry...

Code:
Not Found

The requested URL /_usr/example1${REQUEST_URI} was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

Reply With Quote
  #6  
Old September 16th, 2012, 07:15 PM
requinix's Avatar
requinix requinix is offline
Still alive
Dev Shed God 16th Plane (12500 - 12999 posts)
 
Join Date: Mar 2007
Location: Washington, USA
Posts: 12,861 requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)  Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 5 Months 1 Week 5 Days 5 h 45 m 49 sec
Reputation Power: 8977
Send a message via AIM to requinix Send a message via MSN to requinix Send a message via Yahoo to requinix Send a message via Google Talk to requinix
That $ should be a %. Damn Apache and it doing variables in a weird way.

Reply With Quote
  #7  
Old September 16th, 2012, 09:08 PM
Wayniac Wayniac is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2009
Posts: 50 Wayniac New User: is a brand new recruit and a unknown entity at this point. 
Time spent in forums: 12 h 7 m 53 sec
Reputation Power: 0
Thanks requinix, but unfortunately its still not working. Below is the code I used to confirm... Is there a condition I should be using with this rule? Sorry, this is all new to me so its a lot to take in.

Code:
RewriteRule ^(%!_usr/example1) _usr/example1${REQUEST_URI} [L]

Reply With Quote
  #8  
Old September 16th, 2012, 11:04 PM
requinix's Avatar
requinix requinix is offline
Still alive
Dev Shed God 16th Plane (12500 - 12999 posts)
 
Join Date: Mar 2007
Location: Washington, USA
Posts: 12,861 requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)  Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 5 Months 1 Week 5 Days 5 h 45 m 49 sec
Reputation Power: 8977
Send a message via AIM to requinix Send a message via MSN to requinix Send a message via Yahoo to requinix Send a message via Google Talk to requinix
I don't know what you did there so lemme just post the correct version.
Code:
RewriteRule ^(?!_usr/example1) _usr/example1%{REQUEST_URI} [L]

Reply With Quote
  #9  
Old September 17th, 2012, 06:10 AM
Wayniac Wayniac is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2009
Posts: 50 Wayniac New User: is a brand new recruit and a unknown entity at this point. 
Time spent in forums: 12 h 7 m 53 sec
Reputation Power: 0
Hmmm it never liked that very much... Shot out a 500 Internal Error. Do you think the problem could be with Joomla? I enabled both of the required fields, SEO URLs and URL ReWriting.

Reply With Quote
  #10  
Old September 17th, 2012, 11:23 AM
requinix's Avatar
requinix requinix is offline
Still alive
Dev Shed God 16th Plane (12500 - 12999 posts)
 
Join Date: Mar 2007
Location: Washington, USA
Posts: 12,861 requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)  Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 5 Months 1 Week 5 Days 5 h 45 m 49 sec
Reputation Power: 8977
Send a message via AIM to requinix Send a message via MSN to requinix Send a message via Yahoo to requinix Send a message via Google Talk to requinix
Have you checked the error logs to see what is causing the 500s?

Reply With Quote
  #11  
Old September 17th, 2012, 07:24 PM
Wayniac Wayniac is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2009
Posts: 50 Wayniac New User: is a brand new recruit and a unknown entity at this point. 
Time spent in forums: 12 h 7 m 53 sec
Reputation Power: 0
This may be a silly question, but should I be placing the .htaccess file under the root of "example.com" or under "example.com/_usr/example1"?

As of now I have the root (example.com) setup to redirect it over to (example.com/_usr/example1), and then the under (example.com/_usr/example1) I have your code.

Reply With Quote
  #12  
Old September 17th, 2012, 07:44 PM
requinix's Avatar
requinix requinix is offline
Still alive
Dev Shed God 16th Plane (12500 - 12999 posts)
 
Join Date: Mar 2007
Location: Washington, USA
Posts: 12,861 requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)  Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 5 Months 1 Week 5 Days 5 h 45 m 49 sec
Reputation Power: 8977
Send a message via AIM to requinix Send a message via MSN to requinix Send a message via Yahoo to requinix Send a message via Google Talk to requinix
What it's changing is how the root of the website behaves so the code should go in the root .htaccess. But putting it somewhere else shouldn't cause a 500 (it just wouldn't do any rewriting) so still check the logs.

So how it goes is like this:
1. User goes to example.com/some/path
2. The root .htaccess has a RewriteRule which says
Quote:
Anything that doesn't start with "_usr/example1" should be rewritten as "_usr/example1" + the original request path.

3. The new URL is now example.com/_usr/example1/some/path
4? The root .htaccess has that same RewriteRule, but this time the path does start with "_usr/example1" so nothing happens
5. Joomla has its own URL rewriting scheme which turns the relative "/some/path" into something (such as index.php?path=some/path)

#4 may not happen, I'm still unsure how the whole process works and how [L] and [N] affect it.

Note how there isn't any redirecting, just rewriting. The former will actually send the user someplace while the latter happens behind the scenes.

Reply With Quote
  #13  
Old September 17th, 2012, 08:27 PM
Wayniac Wayniac is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2009
Posts: 50 Wayniac New User: is a brand new recruit and a unknown entity at this point. 
Time spent in forums: 12 h 7 m 53 sec
Reputation Power: 0
Very well written requinix,

My apologies if I explained my issue improperly. What I need may be the oposite of what you have offered. I'm trying to figure out how to have it setup as "example.com/some/path". Currently is works as "example.com/_usr/example1/some/path".

See, its installed under "example.com/_usr/example1" but I wish to have it displayed to the public as if it was installed under "example.com".

Reply With Quote
  #14  
Old September 17th, 2012, 09:37 PM
requinix's Avatar
requinix requinix is offline
Still alive
Dev Shed God 16th Plane (12500 - 12999 posts)
 
Join Date: Mar 2007
Location: Washington, USA
Posts: 12,861 requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)  Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 5 Months 1 Week 5 Days 5 h 45 m 49 sec
Reputation Power: 8977
Send a message via AIM to requinix Send a message via MSN to requinix Send a message via Yahoo to requinix Send a message via Google Talk to requinix
Yeah... That's what I've been going with so far. Everything I've said and posted is for that idea.

The user will still see example.com/some/path but Apache and Joomla will see it as example.com/_usr/example1/some/path. That's how URL rewriting works.

Reply With Quote
  #15  
Old September 18th, 2012, 06:43 AM
Wayniac Wayniac is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2009
Posts: 50 Wayniac New User: is a brand new recruit and a unknown entity at this point. 
Time spent in forums: 12 h 7 m 53 sec
Reputation Power: 0
Here is my .htaccess code within the root (/) directory.
Code:
# Begin default subdomain redirect # RewriteEngine on # End default subdomain redirect #  <Files *> # Begin varnish cache - disables server cache # Header set Cache-Control: "private, pre-check=0, post-check=0, max-age=0" Header set Expires: 0 Header set Pragma: no-cache # End varnish cache # </Files>  # Modify the RewriteBase if you are using Joomla in a subdirectory or in a # VirtualDocumentRoot and the rewrite rules are not working properly. # For example if your site is at http://example.com/joomla uncomment and # modify the following line: RewriteBase /  RewriteRule ^(?!_usr/example1) _usr/example1%{REQUEST_URI} [L]


Here is the Error Log
Code:
[Tue Sep 18 03:49:09 2012] [error] [client 184.171.206.20] File does not exist: /var/chroot/home/content/87/9580087/html/_usr/example1/missing.html [Tue Sep 18 04:31:31 2012] [error] [client 76.11.82.16] File does not exist: /var/chroot/home/content/87/9580087/html/_usr/example1/_usr [Tue Sep 18 04:31:31 2012] [error] [client 76.11.82.16] File does not exist: /var/chroot/home/content/87/9580087/html/_usr/example1/_usr [Tue Sep 18 04:31:38 2012] [error] [client 76.11.82.16] File does not exist: /var/chroot/home/content/87/9580087/html/_usr/example1/_usr [Tue Sep 18 04:31:38 2012] [error] [client 76.11.82.16] File does not exist: /var/chroot/home/content/87/9580087/html/_usr/example1/_usr

Last edited by Wayniac : September 18th, 2012 at 03:40 PM.

Reply With Quote
Reply

Viewing: Dev Shed ForumsSystem AdministrationApache Development > Mod_rewrite assistance

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap