Page 1 of 1

app.php routing issue

Posted: Tue Mar 24, 2015 3:10 am
by Geed
I have a link defined as follows:

Code: Select all

$this->template->assign_vars(array(
	'U_CALENDAR_PAGE'	=> $this->helper->route('main');,
));
This works fine when I'm on http://www.board.com/index.php. This leads me to http://www.board.com/app.php/calendar and my app shows up.

However, when I'm on http://www.board.com, this link sends me to http://www.board.com/calendar, and gives me a 404.

How can I fix this?

Thanks!

Re: app.php routing issue

Posted: Tue Mar 24, 2015 3:58 pm
by VSE
You have to uncomment the line RewriteBase / in the .htaccess file

Re: app.php routing issue

Posted: Tue Mar 24, 2015 4:19 pm
by mrgtb
That doesn't make any real difference.

Re: app.php routing issue

Posted: Tue Mar 24, 2015 7:04 pm
by Geed
VSE wrote:You have to uncomment the line RewriteBase / in the .htaccess file
Is there any other workaround? I'm writing this into an extension and I would like it to work with an unmodified .htaccess.

Re: app.php routing issue

Posted: Tue Mar 24, 2015 7:33 pm
by nicofuma
This line is server dependent and if it's needed, it is for all the extension so... no their isn't any workaround

Re: app.php routing issue

Posted: Tue Mar 24, 2015 7:47 pm
by jsebean
The only other way without rewrite is to... well... not use rewrite. I don't actually know exactly how the extension system works specifically, but surely you can create your own calendar directory with it's own index.php that doesn't depend on rewrite engine?

Otherwise just uncomment it, but note that htaccess doesn't work with anything but apache that I know of ;). Eg. no nginx or lighttpd support.

Otherwise, just depend on app.php and allow the rewrite to be optional for people who do have apache.

Re: app.php routing issue

Posted: Tue Mar 24, 2015 8:22 pm
by Geed
So in that case, how do other extensions add links to the overall header?

EDIT: Okay no need to use route. Here's the fix:

Code: Select all

$this->template->assign_vars(array(
     'U_CALENDAR_PAGE'    => generate_board_url() . "/app.php/calendar",
)); 

Re: app.php routing issue

Posted: Tue Mar 24, 2015 8:39 pm
by nicofuma
Or just disable the URL Rewriting in the acp?

Re: app.php routing issue

Posted: Wed Mar 25, 2015 1:23 am
by VSE
If you enabled url rewriting in the ACP, which only does 1 thing and that is to remove the app.php part of the URL from any links to front controllers (currently only used by extensions)...this is all handled by htaccess...not extensions or phpBB so much...so you just need to make sure your server is working right. Some servers need to have the Rewrite Base line and most can leave it commented out.

If you continue having any issues, then disable url rewriting in the ACP, and try to figure out why your server isn't behaving ;) .

Re: app.php routing issue

Posted: Sat Mar 28, 2015 11:23 am
by Marc
This is in fact a known issue and should be resolved by this PR: https://github.com/phpbb/phpbb/pull/3392