Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Code question
#1
I am reviewing the code and find this fragment in index.php:

Code:
// redirect to ignore homepage called as /index/
if (tsl($_SERVER['PHP_SELF']) == '/index/' ) { header('Location: '. $SITEURL ); exit; }

What is this used for?

Thanks.
Reply
#2
It's checking to see if the user put: http://mysite.com/index or index/ and if they did just redirect them to http://mysite.com
http://nijikokun.com
random stuff. idk.
Reply
#3
Nijikokun Wrote:It's checking to see if the user put: http://mysite.com/index or index/ and if they did just redirect them to http://mysite.com

Sorry, I guess I didn't ask the right question. Why is the code there?

We are already executing the index.php code so why redirect back to ourselves -- which will then just execute index.php again -- right?

Is there a security issue? What am I missing?

Thanks,
~Joe
Reply
#4
it should take care of duplicate content. This has never caused a loop in the install.
- Chris
Thanks for using GetSimple! - Download

Please do not email me directly for help regarding GetSimple. Please post all your questions/problems in the forum!
Reply
#5
ccagle8 Wrote:it should take care of duplicate content. This has never caused a loop in the install.
Yes, but it gives me some 500 error on some sites !
Will post soon a solution (i am looking to my logs to understand what happened).
Sharing is human real nature...
Reply
#6
thanks superyms - i've never seen a problem with it, or at least one has never been reported, so i am interested what you find out.
- Chris
Thanks for using GetSimple! - Download

Please do not email me directly for help regarding GetSimple. Please post all your questions/problems in the forum!
Reply
#7
I only see it sending a loop if you put the cms in a directory named /index/
http://nijikokun.com
random stuff. idk.
Reply
#8
I hope I'm not beating a dead horse here but I am new to the GS.
I am trying to understand the internals so I am looking at the logic decisions behind the design.

Can you give me an example of a URL a user would call that would generate a different result depending on if the
Code:
if (tsl($_SERVER['PHP_SELF']) == '/index/' ) { header('Location: '. $SITEURL ); exit; }
code is active or commented out?

~Joe
Reply
#9
without Fancy URLS, the query string is index.php?id=index, with Fancy URLs on, it is /index/ (it just replaces the ID with the page slug) - in this case it is the homepage or index page.
- Chris
Thanks for using GetSimple! - Download

Please do not email me directly for help regarding GetSimple. Please post all your questions/problems in the forum!
Reply
#10
It's fancy urls that's causing your 500 error. I ran into today with this girl.
http://nijikokun.com
random stuff. idk.
Reply
#11
Nijikokun Wrote:It's fancy urls that's causing your 500 error. I ran into today with this girl.
I confirm Fancy URL caused 500 errors.
Sharing is human real nature...
Reply
#12
I'm running GS 2.0 w/fancy urls on and Im not seeing this error? What are the circumstances that we see the 500 error?
- Chris
Thanks for using GetSimple! - Download

Please do not email me directly for help regarding GetSimple. Please post all your questions/problems in the forum!
Reply
#13
ccagle8 Wrote:I'm running GS 2.0 w/fancy urls on and Im not seeing this error? What are the circumstances that we see the 500 error?
It worked in a sub directory, however on root it started displaying a 500 error. I fixed it by turning off fancy urls. If placed back into a sub directory it worked again.

This is on someone else's host and not mine, I have no idea what was causing it.
http://nijikokun.com
random stuff. idk.
Reply
#14
with the latest revision that will be in 2.01 this line of code can likely be removed. It was there because sometimes I would see a page with /index/ in the url... but I have since centralized all URL creation under a new function that should NEVER return a URL like domain.com/index/

looks like with the CKEditor and these slug problems (that were probably there the whole life of this CMS) we will be releasing 2.01 soon...
- Chris
Thanks for using GetSimple! - Download

Please do not email me directly for help regarding GetSimple. Please post all your questions/problems in the forum!
Reply
#15
I would like to bring this issue (500 errors with Use Fancy URLs on) into the present. Please bear with me:


I installed GS30 in sub-directory (something else was at the root at the time.)
I removed root application and installed GS30 there.
Migrated files and settings to the new installation. (I had paid special attention to the Base URL, etc.)

Now my Home page (index) works, but any pages or sub-pages throw the 500 with Use Fancy URLs on.
Looks like there must be something relative to the old sub-dir installation lurking.
My first thought was that it was in the page XML, so I trashed everything except the index which worked. Recreated the first page and the 500 showed up.

Must be deeper. Any ideas?
Reply
#16
snooze Wrote:I would like to bring this issue (500 errors with Use Fancy URLs on) into the present. Please bear with me:

Migrated files and settings to the new installation. (I had paid special attention to the Base URL, etc.)
How does your .htaccess file look like? Maybe we can spot something there, otherwise it's mere guesswork.
Reply
#17
Thorsten lead me there and I found the problem.

Path other than the root left over from my previous installation in sub-dir.

Thanks
Reply
#18
snooze Wrote:Path other than the root left over from my previous installation in sub-dir.
It's often those little things with a huge impact. Keep rocking with GS! \m/
Reply




Users browsing this thread: 1 Guest(s)