Jump to ContentJump to Navigation/Login
` ` ` ` ` `

[Register]

Occasional ATutor release updates


No Members Logged In

(4 guests in past 15 min.)

Access Understanding Web Accessibility to learn about accessibility, or Register to take the course for FREE.

Support Forums

Development Forum

url_rewrite not working as expected


You must be signed-in to post.

AuthorSubject
  Page: 1
havardp

Avatar for havardp
Subject: url_rewrite not working as expectedQuote this post in your reply
For our assignment question type for the test module we generate a download link with the following code:

<a target="new" href="<?php echo url_rewrite('tools/tests/download.php?fid='.$this->answer['file_id'], AT_PRETTY_URL_IS_HEADER); ?>"><?php echo _AT('Download'); ?></a>

But the url_rewrite function strip ".php" from the script name, so we end up with a 404 error.
Posted: 2009-08-31 09:19:26
havardp

Avatar for havardp
Subject: Re: url_rewrite not working as expectedQuote this post in your reply
Just wanted to add that we have pretty urls turned on. smile
Posted: 2009-08-31 09:21:04
harris

Avatar for harris
Subject: Re: url_rewrite not working as expectedQuote this post in your reply
Hello,

Do you have mod_rewrite on as well?
Posted: 2009-08-31 10:03:10
havardp

Avatar for havardp
Subject: Re: url_rewrite not working as expectedQuote this post in your reply
Yes, we have. But I don't see how url_rewrite should translate the URL different.
Posted: 2009-09-01 04:10:36
harris

Avatar for harris
Subject: Re: url_rewrite not working as expectedQuote this post in your reply
We have several rules in .htaccess file to rewrite the url to a shorter form. So, one of the rules that I have in the .htaccess might take out .php if it thinks that it is part of the 'pretty url'. Feel free to adjust the .htaccess rule for your own system.
Posted: 2009-09-02 11:47:27
havardp

Avatar for havardp
Subject: Re: url_rewrite not working as expectedQuote this post in your reply
I'm having problems with the url_rewrite() function in the ATutor API, not the mod_rewrite rules in .htaccess.
Posted: 2009-09-03 02:29:33
harris

Avatar for harris
Subject: Re: url_rewrite not working as expectedQuote this post in your reply
Could be a bug in the rewrite class, i will check that.
Posted: 2009-09-03 09:10:49
harris

Avatar for harris
Subject: Re: url_rewrite not working as expectedQuote this post in your reply
To shorten the URL, some of them have the .php being taken out. Though, the condition seems to be imperfect. You can add another condition in line 272 to by pass your code for now.

under
include/classes/UrlRewrite/UrlRewrite.class.php
Posted: 2009-09-03 09:40:29
 Page: 1

You must be signed-in to post.