• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
htaccess redirect 301 single url

#11
[eluser]ironlung[/eluser]
[quote author="TheFuzzy0ne" date="1363174194"]Does this not work?

Code:
RewriteCond %{REQUEST_URI} ^(/controller/method/value1)
RewriteRule ^(.*)$ /controller/method/value2 [L,R=301]
[/quote]

That takes me to the homepage... I really appreciate your help.

#12
[eluser]TheFuzzy0ne[/eluser]
This is peculiar. It works for me with no problems.

Have you tried typing the URL you want to go to into the address bar, to make sure it's working as expected?

#13
[eluser]ironlung[/eluser]
[quote author="TheFuzzy0ne" date="1363175084"]This is peculiar. It works for me with no problems.

Have you tried typing the URL you want to go to into the address bar, to make sure it's working as expected? [/quote]

Yeah it's absolutely fine when I type it in.

I haven't touched this since I made the site which was way back in codeigniter 1.7 or earlier, maybe nearly 4 years ago. At that time Elliot Haughlin and others made that file which became like a standard for getting rid of index.php etc.

Is there like a new standard file for this type of thing that I could change to?

#14
[eluser]TheFuzzy0ne[/eluser]
Not to my knowledge. Even Elliot's old .htaccess doesn't seem to be anywhere on the wiki. I think it got lost when they changed Wiki back ends.

I'm sorry, but I don't know what else to suggest. Since what I posted was working for me, we need to figure out why it's not working for you. However, I'm completely out of ideas. Where's Elliot HT Access when ya need him? Smile

#15
[eluser]ironlung[/eluser]
Hey FuzzyOne

Thanks for all your help, I've managed to get it working. I was altering the line after the check for the system folder and after the check to see if it was after a valid file Doh!


I am really sorry to take up so much of you time when I moved it above this

Code:
#Removes access to the system folder by users.
    #Additionally this will allow you to create a System.php controller,
    #previously this would not have been possible.
    #'system' can be replaced if you have renamed your system folder.
    RewriteCond %{REQUEST_URI} ^system.*
    RewriteRule ^(.*)$ /index.php?/$1 [L]
  
    #Checks to see if the user is attempting to access a valid file,
    #such as an image or css document, if this isn't true it sends the
    #request to index.php
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ /index.php?/$1 [L]

It all worked fine.

I really, really don't understand .htaccess at all. I'm not dumb by any stretch of the imagination, it's just my stumbling block.

#16
[eluser]Aken[/eluser]
Keep in mind that .htaccess files fire rules in succession. If something matches and redirects, the file stops doing checks at that point. Same with the [L] flag, which means "Last", e.g. stop here.

#17
[eluser]ironlung[/eluser]
[quote author="Aken" date="1363199887"]Keep in mind that .htaccess files fire rules in succession. If something matches and redirects, the file stops doing checks at that point. Same with the [L] flag, which means "Last", e.g. stop here.[/quote]

Cheers Aken I now know more than I did at 2am last night Smile

#18
[eluser]TheFuzzy0ne[/eluser]
You live and you learn. If I was Superman, .htaccess would be my Kryptonite...

It's only on occasion that I've needed to play with .htaccess files, so I am also still learning. Glad you got it sorted.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.