app.php routing issue

Discussion forum for Extension Writers regarding Extension Development.
Post Reply
Geed
Registered User
Posts: 197
Joined: Sat Sep 20, 2008 1:02 am
Location: Princeton, NJ
Name: DG Kim
Contact:

app.php routing issue

Post by Geed » Tue Mar 24, 2015 3:10 am

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!
DG Kim | Princeton '18
Electrical Engineering

User avatar
VSE
Extensions Development Coordinator
Extensions Development Coordinator
Posts: 4864
Joined: Sat Jan 17, 2009 9:37 am
Location: Los Angeles, CA
Name: Matt Friedman
Contact:

Re: app.php routing issue

Post by VSE » Tue Mar 24, 2015 3:58 pm

You have to uncomment the line RewriteBase / in the .htaccess file
Dictated but not read.
Official phpBB Extensions My Extensions & MODs
Please do not PM me for support.

User avatar
mrgtb
Registered User
Posts: 557
Joined: Wed Oct 03, 2007 10:51 am

Re: app.php routing issue

Post by mrgtb » Tue Mar 24, 2015 4:19 pm

That doesn't make any real difference.

Geed
Registered User
Posts: 197
Joined: Sat Sep 20, 2008 1:02 am
Location: Princeton, NJ
Name: DG Kim
Contact:

Re: app.php routing issue

Post by Geed » Tue Mar 24, 2015 7:04 pm

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.
DG Kim | Princeton '18
Electrical Engineering

nicofuma
3.2 Release Manager
3.2 Release Manager
Posts: 546
Joined: Sun Apr 13, 2014 1:47 am
Location: Grenoble - France

Re: app.php routing issue

Post by nicofuma » Tue Mar 24, 2015 7:33 pm

This line is server dependent and if it's needed, it is for all the extension so... no their isn't any workaround
Member of phpBB Development-Team
No Support via PM

User avatar
jsebean
Registered User
Posts: 378
Joined: Sat Dec 12, 2009 3:20 pm
Location: Atlantic Canada
Name: Jonah
Contact:

Re: app.php routing issue

Post by jsebean » Tue Mar 24, 2015 7:47 pm

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.
-Jonah
:lol:

Geed
Registered User
Posts: 197
Joined: Sat Sep 20, 2008 1:02 am
Location: Princeton, NJ
Name: DG Kim
Contact:

Re: app.php routing issue

Post by Geed » Tue Mar 24, 2015 8:22 pm

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",
)); 
DG Kim | Princeton '18
Electrical Engineering

nicofuma
3.2 Release Manager
3.2 Release Manager
Posts: 546
Joined: Sun Apr 13, 2014 1:47 am
Location: Grenoble - France

Re: app.php routing issue

Post by nicofuma » Tue Mar 24, 2015 8:39 pm

Or just disable the URL Rewriting in the acp?
Member of phpBB Development-Team
No Support via PM

User avatar
VSE
Extensions Development Coordinator
Extensions Development Coordinator
Posts: 4864
Joined: Sat Jan 17, 2009 9:37 am
Location: Los Angeles, CA
Name: Matt Friedman
Contact:

Re: app.php routing issue

Post by VSE » Wed Mar 25, 2015 1:23 am

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 ;) .
Dictated but not read.
Official phpBB Extensions My Extensions & MODs
Please do not PM me for support.

User avatar
Marc
Development Team Leader
Development Team Leader
Posts: 5387
Joined: Tue Oct 30, 2007 10:57 pm
Location: Munich, Germany
Name: Marc
Contact:

Re: app.php routing issue

Post by Marc » Sat Mar 28, 2015 11:23 am

This is in fact a known issue and should be resolved by this PR: https://github.com/phpbb/phpbb/pull/3392

Post Reply

Return to “Extension Writers Discussion”