Removing "index.php" from the Home link on the menu?

Started by ocmdiaz714, October 16, 2012, 02:21:08 AM

Previous topic - Next topic

ocmdiaz714

I would like to remove the "index.php" from the Home link on my menu. I have tried going into the subs file and replacing the href value from scripturl to "/" but that only broke the forum. I also tried changing the value to boardurl, and it works for the index page, but when I'm on a topic, board, or any other page, it's basically a link to the page at hand. EX: I would be viewing a topic and the link (boardurl) would translate to "index.php?topic=312.msg2369#new"

Any help?

I basically want nothing but the root url (where my forums are installed) as the link for the Home/Forums item.


ocmdiaz714

Quote from: No More Mr Nice Sully on October 16, 2012, 02:47:22 AM
May be you can try this instead? http://stackoverflow.com/questions/7888620/removing-index-php-htaccess

The thing is that I want to keep the index.php for every other link that uses it. I don't like the way ".com/?act=" looks.

hcfwesker

Maybe try the Pretty URLs MOD.  it rewrites page urls to what you're viewing, in most cases.

http://custom.simplemachines.org/mods/index.php?mod=636

Hj Ahmad Rasyid Hj Ismail

Quote from: No More Mr Nice Sully on February 24, 2011, 09:48:11 AM
You can, however, rewrite it instead removing it as above mentioned via creating .htaccess file with these lines inside.
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{REQUEST_URI} ^\/index.php$
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^(.*)$ / [L,R=301]

or if you already have .htaccess file, just add the last three lines inside it.

This will remove index.php from your forum homepage url but not others. Your forum will open just fine unlike the earlier method mentioned above that caused certain browser unable to properly read your forum css when visiting for the first time without refreshing it.


Good luck.

ocmdiaz714

Quote from: No More Mr Nice Sully on October 16, 2012, 03:36:21 AM
Quote from: No More Mr Nice Sully on February 24, 2011, 09:48:11 AM
You can, however, rewrite it instead removing it as above mentioned via creating .htaccess file with these lines inside.
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{REQUEST_URI} ^\/index.php$
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^(.*)$ / [L,R=301]

or if you already have .htaccess file, just add the last three lines inside it.

This will remove index.php from your forum homepage url but not others. Your forum will open just fine unlike the earlier method mentioned above that caused certain browser unable to properly read your forum css when visiting for the first time without refreshing it.


Good luck.

Could you tell me how to change the menu link completely? Instead of scripturl I want to link to "/" that's what I'm using for my logo's link, and I like for the menu link to be the same. Thanks.

hcfwesker

Sources/Subs.php  ( always save a backup of files ebfore you manually edit the)

Find
'home' => array(
'title' => $txt['home'],
'href' => $scripturl,


Change
'href' => $scripturl,

To
'href' => 'http://www.FORUMLINK.com',

and put your link over the http://www.FORUMLINK.com  in place of link above.  Leave the surrounding apostrophe's in place.

ocmdiaz714

Quote from: hcfwesker on October 16, 2012, 05:31:00 AM
Sources/Subs.php  ( always save a backup of files ebfore you manually edit the)

Find
'home' => array(
'title' => $txt['home'],
'href' => $scripturl,


Change
'href' => $scripturl,

To
'href' => 'FORUM LINK',

and put you link http://forumlinkcom  in place of the FORUM LINK text

Nice. Thanks! Can I put in a slash instead of a forum link?

hcfwesker

then the HOME button will just link to a slash (broken page), nothing else.   :o

You can put a slash at the end of the link you add.  also i edited my post above

ocmdiaz714

Quote from: hcfwesker on October 16, 2012, 05:34:04 AM
then the HOME button will just link to a slash (broken page), nothing else.   :o

You can put a slash at the end of the link you add.  also i edited my post above

I currently have my logo linked to a slash and it works fine though. :o I basically want: "http://www.domain.com/" And I don't know about adding my entire domain as it looks messy and I want it ready for any domain changes.

Arantor

You could remove it from that point, sure, but there are like a bazillion other places where SMF will automatically link back to index.php anyway. And no, removing that is not a good idea. It will break things for users down the line (as it does every time people want to remove it)
Holder of controversial views, all of which my own.


Hj Ahmad Rasyid Hj Ismail

I would agree with Arantor. If you need only to rewrite index.php in homepage that would be fine. Otherwise, as Arantor said, it might break things at your users' end.

Advertisement: