Solved

rewrite same url using slash AND no slash

Posted on 2011-02-14
3
445 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
  • 2
3 Comments
 
LVL 16

Accepted Solution

by:
sjklein42 earned 500 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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

746 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now