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 February 19th, 2013, 08:23 PM
chrismichaels84 chrismichaels84 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2012
Posts: 20 chrismichaels84 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 48 m 11 sec
Reputation Power: 0
URL rewriting broken -- subfolder works, root folder doesn't

I feel like this should be an easy bug to fix, but I don't see it. I am very new to Apache and rewrite rules.

I have three four on my site. Two use a multi-site wordpress install, one uses Elgg and the fourth is codeigniter.
/social/ -> elgg
/actions/ -> codeigniter
/about/ -> wordpress
/academy/ -> wordpress

My problem is in the /social/ rewrite. Everything else works. I actually removed everything else and the social rewrite gives me a problem. What I need is for
/social -> /elgg-core/
/social/ -> /elgg-core/
/social/whatever -> /elgg-core/whatever
/whatever/ -> /elgg-core/profile/whatever

Here is what I have:

Code:

### Third, check for the social module
RewriteRule ^social(.+)$ elgg-core/$1 [NC,L]

### Last, look for a user profile or 404 error
RewriteRule ^(.+)$ elgg-core/profile/$1 [NC,L]


The profile rewrite works and anything like /social/whatever works, but the /social and /social/ give me 404 errors.

Any help would be greatly appreciated

Here is the code in context, if needed

Code:
<IfModule mod_rewrite.c>

RewriteEngine On

### Where do we begin?
RewriteBase /dmgconnect/

### Where is the wordpress multisite file?
RewriteRule ^wordpress\.php$ - [L]

### add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]

### Set our conditions
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d 

#### URL Rewrite Rules
### First, check for wordpress sites (about, academy)
RewriteRule ^ - [L]

# Rewrite the wordpress admin stuff
RewriteRule ^(.+)/?(wp-(content|admin|includes).*) wp-core/$2 [L] #
RewriteRule ^(.+)/?(.*\.php)$ wp-core/$2 [L]

# Rewrite for the two sites (if more added, we must rewrite for them specifically
RewriteRule ^about(.+) wordpress.php [L]
RewriteRule ^academy(.+) wordpress.php [L]


### Second, is there anything for CodeIgniter specifically?
RewriteRule ^actions/(.+)$ index.php/$1 [NC,L]


### Third, check for the social module
RewriteRule ^social(.+)$ elgg-core/$1 [NC,L]


### Last, look for a user profile or 404 error
RewriteRule ^(.+)$ elgg-core/profile/$1 [NC,L]

</IfModule>

Last edited by chrismichaels84 : February 20th, 2013 at 01:24 PM. Reason: Clarification

Reply With Quote
  #2  
Old February 20th, 2013, 12:25 PM
requinix's Avatar
requinix requinix is offline
Still alive
Click here for more information.
 
Join Date: Mar 2007
Location: Washington, USA
Posts: 12,714 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 4 Days 7 h 5 m 48 sec
Reputation Power: 8969
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
.+ means one or more characters. Sounds like you want .* meaning zero or more characters.

Reply With Quote
  #3  
Old February 20th, 2013, 01:16 PM
chrismichaels84 chrismichaels84 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2012
Posts: 20 chrismichaels84 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 48 m 11 sec
Reputation Power: 0
Thanks for the reply. That gets me somewhere, but I'm still getting a strange 404.

My problem is in the /social/ rewrite. Everything else works. I actually removed everything else and the social rewrite give me a problem. What I need is for
/social -> /elgg-core/
/social/ -> /elgg-core/
/social/whatever -> /elgg-core/whatever
/whatever/ -> /elgg-core/profile/whatever

Here is what I have:

Code:
### Third, check for the social module
RewriteRule ^social(.+)$ elgg-core/$1 [NC,L]

### Last, look for a user profile or 404 error
RewriteRule ^(.+)$ social/profile/$1 [NC,L]


The profile rewrite works and anything like /social/whatever works, but the /social and /social/ give me 404 errors.

Thanx

Reply With Quote
  #4  
Old February 20th, 2013, 01:49 PM
requinix's Avatar
requinix requinix is offline
Still alive
Click here for more information.
 
Join Date: Mar 2007
Location: Washington, USA
Posts: 12,714 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 4 Days 7 h 5 m 48 sec
Reputation Power: 8969
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
Like I said, it sounds like you should be using .*

Also consider how "social/" will be rewritten to "elgg-core//". Note the second slash. That may be causing your 404. Try a structure more like
Code:
RewriteRule ^social(/.*)? elgg-core$1 [NC,L]

That is, "social" may be by itself but if not then it has to be followed by at least a slash.

Reply With Quote
  #5  
Old February 20th, 2013, 02:08 PM
chrismichaels84 chrismichaels84 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2012
Posts: 20 chrismichaels84 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 48 m 11 sec
Reputation Power: 0
Thank you, I believe that took care of it!

Reply With Quote
Reply

Viewing: Dev Shed ForumsSystem AdministrationApache Development > URL rewriting broken without trailing slash

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