Linux Help
 
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 ForumsOperating SystemsLinux Help

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 June 19th, 2012, 01:56 AM
raduenea raduenea is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2011
Posts: 3 raduenea User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 25 m 32 sec
Reputation Power: 0
Simple mod_rewrite

Hi

How can I simplify the mod_rewrite:

Code:
RewriteRule ^picturi~peisaj-rural~([0-9]+)$ index.php?page=picturi&filtru=subiecte-detaliate&tip=peisaj-rural&gal=$1 [QSA,L]
RewriteRule ^picturi~peisaj-urban~([0-9]+)$ index.php?page=picturi&filtru=subiecte-detaliate&tip=peisaj-urban&gal=$1 [QSA,L]
RewriteRule ^picturi~rauri~([0-9]+)$ index.php?page=picturi&filtru=subiecte-detaliate&tip=rauri&gal=$1 [QSA,L]

RewriteRule ^picturi~abstract~([0-9]+)$ index.php?page=picturi&filtru=subiecte-generale&tip=abstract&gal=$1 [QSA,L]
RewriteRule ^picturi~altele~([0-9]+)$ index.php?page=picturi&filtru=subiecte-generale&tip=altele&gal=$1 [QSA,L]
RewriteRule ^picturi~animale~([0-9]+)$ index.php?page=picturi&filtru=subiecte-generale&tip=animale&gal=$1 [QSA,L]
RewriteRule ^picturi~compozitie~([0-9]+)$ index.php?page=picturi&filtru=subiecte-generale&tip=compozitie&gal=$1 [QSA,L]


Idea is not to show in the address bar "subiecte-detaliate" and "subiecte-generale", that why I use to insert manually each category in htaccess.
It's there a simple way?

Thanks

Reply With Quote
  #2  
Old June 25th, 2012, 09:46 AM
esposj-ninja esposj-ninja is offline
Administrator
Developer Shed Admin.
 
Join Date: Jun 2012
Posts: 17 esposj-ninja User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 40 m 26 sec
Reputation Power: 10
That looks tough at first glance, since there's no lookup for whether or not a given url is in "subiecte-detaliate" or "subiecte-generale".

However, all is not lost, depending on your access to the web server. Assuming you can modify your vhost, you can use the rewrite map functionality in Apache to create a lookup table of urls to categories, and then should be able to do this in a single rewrite rule.

You may even be able to pull the map data out of an SQL query if that is where the articles and categories are defined.

Documentation Link: http://httpd.apache.org/docs/current/rewrite/rewritemap.html

Reply With Quote
Reply

Viewing: Dev Shed ForumsOperating SystemsLinux Help > Simple mod_rewrite

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