Solved

rewrite same url using slash AND no slash

Posted on 2011-02-14
3
450 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

If you don't have the right permissions set for your WordPress location in IIS, you won't be able to perform automatic updates. Here's how to fix the problem.
Lease-to-own eliminates the expenditure of hardware replacement and allows you to pay off the server over time. Usually, this is much cheaper than leasing servers. Think of lease-to-own as credit without interest.
The viewer will learn how to count occurrences of each item in an array.
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.

685 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