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 December 10th, 2011, 07:59 PM
drumn4life0789 drumn4life0789 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2008
Posts: 129 drumn4life0789 User rank is Sergeant (500 - 2000 Reputation Level)drumn4life0789 User rank is Sergeant (500 - 2000 Reputation Level)drumn4life0789 User rank is Sergeant (500 - 2000 Reputation Level)drumn4life0789 User rank is Sergeant (500 - 2000 Reputation Level)drumn4life0789 User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 2 Days 23 h 1 m 20 sec
Reputation Power: 10
Other - Mod rewrite question

I know this really isn't php but since mod rewrite is used quite a bit to clean up url's that contain php variables I figured this would probably be the best place to post this question.

I am trying to add a named anchor to the end of my url and get a mod rewrite statement to work with or without that named anchor listed.

Here is what I have now.

Code:
RewriteRule ^faculty/([^/\.]+)/?$ faculty/index.php?pos=$1 [L]


this changes mydomain.com/faculty/?pos=admin
into mydomain.com/faculty/admin/

This page shows every faculty member that is an admin. I have other pages that I want to link to a certain faculty member. So instead of having a new page that only shows a specific faculty member I have added named anchors down the page so that I can link to there.

So i figured this might do the trick but it doesn't seem to be working


Code:
RewriteRule ^faculty/([^/\.]+)/?([^/\.]+)/?$ faculty/index.php?pos=$1#$2 [L]


So i want to be able to have.

mydomain.com/faculty/?pos=admin#bobbarker
become mydomain.com/faculty/admin/bobbarker


Any help would be appreciated

Reply With Quote
  #2  
Old December 10th, 2011, 09:35 PM
E-Oreo's Avatar
E-Oreo E-Oreo is offline
Lost in code
Click here for more information.
 
Join Date: Dec 2004
Posts: 7,931 E-Oreo User rank is General 91st Grade (Above 100000 Reputation Level)E-Oreo User rank is General 91st Grade (Above 100000 Reputation Level)E-Oreo User rank is General 91st Grade (Above 100000 Reputation Level)E-Oreo User rank is General 91st Grade (Above 100000 Reputation Level)E-Oreo User rank is General 91st Grade (Above 100000 Reputation Level)E-Oreo User rank is General 91st Grade (Above 100000 Reputation Level)E-Oreo User rank is General 91st Grade (Above 100000 Reputation Level)E-Oreo User rank is General 91st Grade (Above 100000 Reputation Level)E-Oreo User rank is General 91st Grade (Above 100000 Reputation Level)E-Oreo User rank is General 91st Grade (Above 100000 Reputation Level)E-Oreo User rank is General 91st Grade (Above 100000 Reputation Level)E-Oreo User rank is General 91st Grade (Above 100000 Reputation Level)E-Oreo User rank is General 91st Grade (Above 100000 Reputation Level)E-Oreo User rank is General 91st Grade (Above 100000 Reputation Level)E-Oreo User rank is General 91st Grade (Above 100000 Reputation Level)E-Oreo User rank is General 91st Grade (Above 100000 Reputation Level)  Folding Points: 945 Folding Title: Novice Folder
Time spent in forums: 2 Months 7 h 49 m 26 sec
Reputation Power: 7053
You can't do this because anchors are entirely client side. If the anchor isn't present in the URL the browser will not jump to it.

However, you could redirect mydomain.com/faculty/admin/bobbarker to mydomain.com/faculty/?pos=admin#bobbarker or mydomain.com/faculty/admin#bobbarker by performing an actual redirect using the R flag.
__________________
PHP FAQ
How to program a basic, secure login system using PHP

Quote:
Originally Posted by Spad
Ah USB, the only rectangular connector where you have to make 3 attempts before you get it the right way around

Reply With Quote
  #3  
Old December 10th, 2011, 09:49 PM
kicken's Avatar
kicken kicken is offline
Wiser? Not exactly.
Dev Shed God 1st Plane (5500 - 5999 posts)
 
Join Date: May 2001
Location: Bonita Springs, FL
Posts: 5,654 kicken User rank is General 37th Grade (Above 100000 Reputation Level)kicken User rank is General 37th Grade (Above 100000 Reputation Level)kicken User rank is General 37th Grade (Above 100000 Reputation Level)kicken User rank is General 37th Grade (Above 100000 Reputation Level)kicken User rank is General 37th Grade (Above 100000 Reputation Level)kicken User rank is General 37th Grade (Above 100000 Reputation Level)kicken User rank is General 37th Grade (Above 100000 Reputation Level)kicken User rank is General 37th Grade (Above 100000 Reputation Level)kicken User rank is General 37th Grade (Above 100000 Reputation Level)kicken User rank is General 37th Grade (Above 100000 Reputation Level)kicken User rank is General 37th Grade (Above 100000 Reputation Level)kicken User rank is General 37th Grade (Above 100000 Reputation Level)kicken User rank is General 37th Grade (Above 100000 Reputation Level)kicken User rank is General 37th Grade (Above 100000 Reputation Level)kicken User rank is General 37th Grade (Above 100000 Reputation Level)kicken User rank is General 37th Grade (Above 100000 Reputation Level)  Folding Points: 2670569 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2670569 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2670569 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2670569 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2670569 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2670569 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2670569 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2670569 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2670569 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2670569 Folding Title: Super Ultimate Folder - Level 6
Time spent in forums: 2 Months 2 Weeks 2 Days 5 h 1 m 44 sec
Reputation Power: 3436
There is an apache forum, that is where the question should go. I've reported to post to have it moved.

That said, it may be possible to do what you want, but you would likely have to have the rewrite perform an external redirect to the new URL, rather than it be an internal re-write. The hash component (or anchor) is something that is handled client-side and not relevant on the server.

Rather than trying to rewrite the hash, you could probably also do a url like this:

Code:
mydomain.com/faculty/admin#bobbarker


if that is acceptable. Apache would still re-write internally to the ?pos=admin url and then the client would process the hash when the page is loaded.
__________________
Recycle your old CD's, don't just trash them


Spidermonkey Tutorial;

If I helped out out, show some love with some reputation, or tip with Bitcoins to 1N645HfYf63UbcvxajLKiSKpYHAq2Zxud

Reply With Quote
  #4  
Old December 11th, 2011, 01:12 AM
drumn4life0789 drumn4life0789 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2008
Posts: 129 drumn4life0789 User rank is Sergeant (500 - 2000 Reputation Level)drumn4life0789 User rank is Sergeant (500 - 2000 Reputation Level)drumn4life0789 User rank is Sergeant (500 - 2000 Reputation Level)drumn4life0789 User rank is Sergeant (500 - 2000 Reputation Level)drumn4life0789 User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 2 Days 23 h 1 m 20 sec
Reputation Power: 10
Thanks for the responses and sorry for not putting this in the right location. I have never noticed the apache forum before.

This is what I have come up with now. This works for me because I basically just needed for the faculty members to give out a user friendly url. while the actual url it redirects too is not that important

So using this

Code:
RewriteRule ^/?([a-zA-Z_]+)/([a-zA-Z_]+)$ /jhhs/faculty/$1#$2 [NE,R,L]


works for me.

Thanks Again

Reply With Quote
Reply

Viewing: Dev Shed ForumsSystem AdministrationApache Development > Other - Mod rewrite question

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