Hack Forums
Removing index.php - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Webmasters (https://hackforums.net/forumdisplay.php?fid=141)
+---- Forum: Website Construction (https://hackforums.net/forumdisplay.php?fid=50)
+---- Thread: Removing index.php (/showthread.php?tid=5413764)



Removing index.php - Kill Joy - Sep 23, 2016

I've been having a hard time trying to remove index.php from the forum. I've tried a few different codes.

Here's one:

Code
RewriteCond %{IS_SUBREQ} false
RewriteRule ^index.php$ http://www.example.org [R=301,L]

Anything I'm doing wrong? How do I check if mod_rewrite is enabled?


* - Netflix and Weed - Sep 23, 2016

Try this code out and see if it works.
Code
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]
RewriteRule ^([^\.]+)$ $1.html [NC,L]

After doing this you can go to the link it it will remove the extensions ".html" and ".php" from the url.


* - Maeko - Sep 25, 2016

Why use rewrite rule? Just edit the header template and make the logo redirect to

Code
{$mybb->settings['bburl']}

Instead of

Code
{$mybb->settings['bburl']}/index.php



* - Netflix and Weed - Sep 25, 2016

(Sep 25, 2016 01:37 PM)Maeko Wrote:  Why use rewrite rule? Just edit the header template and make the logo redirect to

Code
{$mybb->settings['bburl']}

Instead of

Code
{$mybb->settings['bburl']}/index.php

because he is probably wanting to change the url in the navigation box of your browser, not in the code of the forum.


* - Kill Joy - Sep 25, 2016

(Sep 25, 2016 03:42 PM)Netflix and Weed Wrote:  because he is probably wanting to change the url in the navigation box of your browser, not in the code of the forum.

Exactly. Thank you.