Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

rewrite same url using slash AND no slash

Posted on 2011-02-14
3
Medium Priority
?
453 Views
Last Modified: 2012-05-11
Hi,

My client wants to be certain that if a site visitor types in a url with OR w/o a trailing slash i.e.

mysite.com/artists/warhol
OR
mysite.com/artists/warhol/

the same page will load.

currently my htaccess file has these rules-i can use one or the other, but not both -I NEED FOR BOTH TO WORK

RewriteRule ^/artists/(.+)$ /artists/artist.cfm?permalink=$1 [QSA]
RewriteRule ^/artists/(.+?)/ /artists/artist.cfm?permalink=$1 [QSA]
0
Comment
Question by:phillystyle123
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 16

Accepted Solution

by:
sjklein42 earned 2000 total points
ID: 34893052
Try using just this one rule:

RewriteRule ^/artists/(.+?)/?$ /artists/artist.cfm?permalink=$1 [QSA] 

Open in new window


The ? after the / (  /?$ ) should make it optional.
0
 

Author Closing Comment

by:phillystyle123
ID: 34893259
perfect  - thanks!
0
 

Author Comment

by:phillystyle123
ID: 34899094
I posted a continuation of this question here:

http://www.experts-exchange.com/Software/Server_Software/Web_Servers/Apache/Q_26823130.html

because I'm having trouble getting the next url in my sequence to pull content from my database
0

Featured Post

Create the perfect environment for any meeting

You might have a modern environment with all sorts of high-tech equipment, but what makes it worthwhile is how you seamlessly bring together the presentation with audio, video and lighting. The ATEN Control System provides integrated control and system automation.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

661 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question