Today's Posts Follow Us On Twitter! TFL Members on Twitter  
Forum search: Advanced Search  
Navigation
Marketplace
  Members Login:
Lost password?
  Forum Statistics:
Forum Members: 24,255
Total Threads: 81,172
Total Posts: 566,876
There are 43 users currently browsing (tf).
 
  Our Partners:
 
  TalkFreelance     Design and Development     Programming :

Help with case sensitivity issues

Thread title: Help with case sensitivity issues
Reply    
    Thread tools Search this thread Display Modes  
02-11-2011, 09:55 PM
#1
jasonladue is offline jasonladue
Status: I'm new around here
Join date: Feb 2011
Location: Joplin, MO, USA
Expertise: Design & Building basic sites
Software: DreamWeaver, Photoshop, FileZi
 
Posts: 9
iTrader: 0 / 0%
 

jasonladue is on a distinguished road

  Old  Help with case sensitivity issues

I am building a small site for a client, and he is wanting a text box on the home page where someone can put in a code and be taken to another page in the site.

The easiest way I found to do this was with the following code.
The part is in the header
<script>
function changeURL(){
window.location =
document.getElementById('txtbx').value + ".php";
}
</script>

This part is in the body.
ACCESS CODE:&nbsp;<input type="text" value="" id="txtbx" />
<input type="button" value="Submit" onmousedown="changeURL();" />

This code does what we want, for the most part. The issue is that he has mailed out the flyers with the code 7STAR. I therefor named the page 7STAR.php and when the code is entered in all caps, it works great. The problem is that we can't count on everyone actually putting it in all caps. The client also has expressed that he does not want me to put a message on the page about all caps. (he has the site exactly how he wants it in his head and is not open to any variation from that. (I'm sure most of the rest of you have had an occasional client like that)).

What I need to know is if there is a way to use HTACCESS to automatically redirect if someone puts in 7Star or 7star. I would also be open to some javascript that may change it on the homepage when someone keys it in.

I appreciate any help anyone can offer on this.

02-11-2011, 10:01 PM
#2
jasonladue is offline jasonladue
Status: I'm new around here
Join date: Feb 2011
Location: Joplin, MO, USA
Expertise: Design & Building basic sites
Software: DreamWeaver, Photoshop, FileZi
 
Posts: 9
iTrader: 0 / 0%
 

jasonladue is on a distinguished road

  Old

I just had the thought to create the two extra pages, 7Star.php and 7star.php and have redirect scripts in them to take them to the correct page, but I would rather not do this if I don't have to.

Thanks in advance for any help

Reply With Quote
02-11-2011, 10:54 PM
#3
Eightloop is offline Eightloop
Eightloop's Avatar
Status: Member
Join date: Jan 2011
Location:
Expertise: Programming, photography
Software: Notepad++, Photoshop
 
Posts: 112
iTrader: 0 / 0%
 

Eightloop is an unknown quantity at this point

  Old

This should do it if the 7star.php file is in the root directory of your website. It should work, I tested it.

PHP Code:
Options +FollowSymlinks
RewriteEngine on

RewriteRule 
^7star.php /7STAR.php [r=301
This will redirect it from 7star.php to 7STAR.php. Sometimes you'll need to leave the "Options +FollowSymlinks" out. This depends on the server.

I hope that helps.

EDIT: Of course this goes into a .htaccess file placed in the root directory of your public folder.

Thanked by:
jasonladue (02-12-2011)
02-11-2011, 11:12 PM
#4
jasonladue is offline jasonladue
Status: I'm new around here
Join date: Feb 2011
Location: Joplin, MO, USA
Expertise: Design & Building basic sites
Software: DreamWeaver, Photoshop, FileZi
 
Posts: 9
iTrader: 0 / 0%
 

jasonladue is on a distinguished road

  Old

This looks great!!
Will this work with two rewrite rules? One for 7Star and one for 7star?

Thanks again.

Reply With Quote
02-11-2011, 11:41 PM
#5
Eightloop is offline Eightloop
Eightloop's Avatar
Status: Member
Join date: Jan 2011
Location:
Expertise: Programming, photography
Software: Notepad++, Photoshop
 
Posts: 112
iTrader: 0 / 0%
 

Eightloop is an unknown quantity at this point

  Old

Sure, add a new line just below:
PHP Code:
RewriteRule ^7Star.php /7STAR.php [r=301
If you already have an .htaccess file, then just copy it below and make sure the first two lines only exist once.

Reply With Quote
Thanked by:
jasonladue (02-12-2011)
02-12-2011, 12:30 AM
#6
Village Genius is offline Village Genius
Village Genius's Avatar
Status: Geek
Join date: Apr 2006
Location: Denver, CO
Expertise: Software
Software: Chrome, Notepad++
 
Posts: 6,893
iTrader: 18 / 100%
 

Village Genius will become famous soon enough

  Old

Also, if you want a solution in javascript:
Code:
var b = 7Star'
document.write(b.toUpperCase() + '.php') //will write 7STAR.php

Thanked by 2 users:
Artashes (02-12-2011), jasonladue (02-12-2011)
02-12-2011, 12:31 AM
#7
jasonladue is offline jasonladue
Status: I'm new around here
Join date: Feb 2011
Location: Joplin, MO, USA
Expertise: Design & Building basic sites
Software: DreamWeaver, Photoshop, FileZi
 
Posts: 9
iTrader: 0 / 0%
 

jasonladue is on a distinguished road

  Old

I tried adding your code to my current .htaccess file and still if I type 7Star or 7star I end up at my error page. I have pasted my .htaccess file below so you can see what I ended up with after adding your code. Below that will be my original .htaccess code so you can compare and hopefully point me in the right direction.

<--begin new .htaccess file-->

AddType x-mapp-php5 .php
Options +FollowSymlinks
RewriteEngine On
RewriteRule ^7Star.php /7STAR.php [r=301]
RewriteRule ^7star.php /7STAR.php [r=301]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.php) /error.php

<--end new .htaccess file-->
<--begin original .htaccess file-->
AddType x-mapp-php5 .php

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.php) /error.php

<--end original .htaccess file-->

Reply With Quote
02-12-2011, 12:54 AM
#8
Eightloop is offline Eightloop
Eightloop's Avatar
Status: Member
Join date: Jan 2011
Location:
Expertise: Programming, photography
Software: Notepad++, Photoshop
 
Posts: 112
iTrader: 0 / 0%
 

Eightloop is an unknown quantity at this point

  Old

Try it without "Options +FollowSymlinks". Depending on your server configuration, you'll need to leave it out.

Just to make sure I understood you right. You type www.yoursite.com/7star.php and you want it to be redirected to www.yoursite.com/7STAR.php?

Reply With Quote
Thanked by 2 users:
Artashes (02-12-2011), jasonladue (02-12-2011)
02-12-2011, 01:38 AM
#9
jasonladue is offline jasonladue
Status: I'm new around here
Join date: Feb 2011
Location: Joplin, MO, USA
Expertise: Design & Building basic sites
Software: DreamWeaver, Photoshop, FileZi
 
Posts: 9
iTrader: 0 / 0%
 

jasonladue is on a distinguished road

  Old

Eightloop, yes, that is correct on what I am trying to do. It did work this time with the "Options +FollowSymlinks" removed. Also, I tried the JS solution from Village Genius and it worked as well. I will hang on to both of these options since I am building this site on my hosting server and my client hasn't decided who he is going to use for his hosting yet so who knows what will happen if I end up dealing with another host's configurations.

Thank you both so much for your help!!

Reply With Quote
Reply    


Thread Tools
Display Modes

  Posting Rules  
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump:
 
  Contains New Posts Forum Contains New Posts   Contains No New Posts Forum Contains No New Posts   A Closed Forum Forum is Closed