Thread Rating:
  • 4 Vote(s) - 3 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Remove index.php from URL
#11
(01-07-2011, 11:34 PM)frostschutz Wrote: Sorry, my bad. QSA is for rewrites, not redirects... Blush

Maybe like this:

RewriteCond %{QUERY_STRING} ^(..*)$
RewriteRule ^index\.php$ http://yoursite/mybb/?%1 [L,NS,R=301]
RewriteRule ^index\.php$ http://yoursite/mybb/ [L,NS,R=301]

Or if Apache is smart even just

RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^index\.php$ http://yoursite/mybb/?%1 [L,NS,R=301]

hmn, neither work.

RewriteCond %{QUERY_STRING} ^(..*)$
RewriteRule ^index\.php$ http://paforliberty.com/forum/?%1 [L,NS,R=301]
RewriteRule ^index\.php$ http://paforliberty.com/forum/ [L,NS,R=301]
Reply
#12
This user has been denied support. This user has been denied support.
Right. Not my day.

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

It's kinda scary to find out that any R=301 redirect breaks POST requests. So basically to be on the safe side you need this RewriteCond for any R=301 rule.

Alternatively you can blame the quicktheme plugin for posting to index.php - it'd probably be safer to abuse misc.php for that.
Reply
#13
(01-08-2011, 12:19 AM)frostschutz Wrote: Right. Not my day.

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

It's kinda scary to find out that any R=301 redirect breaks POST requests. So basically to be on the safe side you need this RewriteCond for any R=301 rule.

Alternatively you can blame the quicktheme plugin for posting to index.php - it'd probably be safer to abuse misc.php for that.

perfect. that did the trick, thanks!
Reply
#14
index.php is part of the breadcrumb mainly so editing global.php does the trick.

$navbits[0]['url'] = $mybb->settings['bburl']."/index.php";

Just remove the index.php part. Then in header template the logo might be linked with index.php so just make that ./ too.

Overall there isn't a need for editing your htaccess.
Reply
#15
Do you know how to change usercp.php to /usercp/ ?

Nice tutorial Smile
Reply
#16
Thank you.
Reply
#17
(01-08-2011, 12:34 AM)Shemo Wrote:
(01-08-2011, 12:19 AM)frostschutz Wrote: Right. Not my day.

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

It's kinda scary to find out that any R=301 redirect breaks POST requests. So basically to be on the safe side you need this RewriteCond for any R=301 rule.

Alternatively you can blame the quicktheme plugin for posting to index.php - it'd probably be safer to abuse misc.php for that.

perfect. that did the trick, thanks!

Hi,

When I try this my forum won't load and gives a, too many redirects message.

Below is my working .htaccess file...

RewriteEngine on

# Some hosts need a RewriteBase specification.
RewriteBase /

# Google SEO workaround for search.php highlights:
# Make this rule the first rewrite rule in your .htaccess!
RewriteRule ^([^&]*)&(.*)$ http://the-chess-forum.com/$1?$2 [L,QSA,R=301]

# Google SEO Sitemap:
RewriteRule ^sitemap-([^./]+)\.xml$ misc.php?google_seo_sitemap=$1 [L,QSA,NC]

# Google SEO URL Forums:
RewriteRule ^Forum-([^./]+)$ forumdisplay.php?google_seo_forum=$1 [L,QSA,NC]

# Google SEO URL Threads:
RewriteRule ^Thread-([^./]+)$ showthread.php?google_seo_thread=$1 [L,QSA,NC]

# Google SEO URL Announcements:
RewriteRule ^Announcement-([^./]+)$ announcements.php?google_seo_announcement=$1 [L,QSA,NC]

# Google SEO URL Users:
RewriteRule ^User-([^./]+)$ member.php?action=profile&google_seo_user=$1 [L,QSA,NC]

# Google SEO URL Calendars:
RewriteRule ^Calendar-([^./]+)$ calendar.php?google_seo_calendar=$1 [L,QSA,NC]

# Google SEO URL Events:
RewriteRule ^Event-([^./]+)$ calendar.php?action=event&google_seo_event=$1 [L,QSA,NC]

# Google SEO 404:
ErrorDocument 404 /misc.php?google_seo_error=404

# Default MyBB Rewrite Rules:
RewriteRule ^forum-([0-9]+)\.html$ forumdisplay.php?fid=$1 [L,QSA]
RewriteRule ^forum-([0-9]+)-page-([0-9]+)\.html$ forumdisplay.php?fid=$1&page=$2 [L,QSA]

RewriteRule ^thread-([0-9]+)\.html$ showthread.php?tid=$1 [L,QSA]
RewriteRule ^thread-([0-9]+)-page-([0-9]+)\.html$ showthread.php?tid=$1&page=$2 [L,QSA]
RewriteRule ^thread-([0-9]+)-lastpost\.html$ showthread.php?tid=$1&action=lastpost [L,QSA]
RewriteRule ^thread-([0-9]+)-nextnewest\.html$ showthread.php?tid=$1&action=nextnewest [L,QSA]
RewriteRule ^thread-([0-9]+)-nextoldest\.html$ showthread.php?tid=$1&action=nextoldest [L,QSA]
RewriteRule ^thread-([0-9]+)-newpost\.html$ showthread.php?tid=$1&action=newpost [L,QSA]
RewriteRule ^thread-([0-9]+)-post-([0-9]+)\.html$ showthread.php?tid=$1&pid=$2 [L,QSA]

RewriteRule ^post-([0-9]+)\.html$ showthread.php?pid=$1 [L,QSA]

RewriteRule ^announcement-([0-9]+)\.html$ announcements.php?aid=$1 [L,QSA]

RewriteRule ^user-([0-9]+)\.html$ member.php?action=profile&uid=$1 [L,QSA]

RewriteRule ^calendar-([0-9]+)\.html$ calendar.php?calendar=$1 [L,QSA]
RewriteRule ^calendar-([0-9]+)-year-([0-9]+)\.html$ calendar.php?action=yearview&calendar=$1&year=$2 [L,QSA]
RewriteRule ^calendar-([0-9]+)-year-([0-9]+)-month-([0-9]+)\.html$ calendar.php?calendar=$1&year=$2&month=$3 [L,QSA]
RewriteRule ^calendar-([0-9]+)-year-([0-9]+)-month-([0-9]+)-day-([0-9]+)\.html$ calendar.php?action=dayview&calendar=$1&year=$2&month=$3&day=$4 [L,QSA]
RewriteRule ^calendar-([0-9]+)-week-(n?[0-9]+)\.html$ calendar.php?action=weekview&calendar=$1&week=$2 [L,QSA]

RewriteRule ^event-([0-9]+)\.html$ calendar.php?action=event&eid=$1 [L,QSA]

RewriteCond %{HTTP_HOST} !^the-chess-forum\.com$ [NC]
RewriteRule ^(.*)$ http://the-chess-forum.com/$1 [L,QSA,R=301]

RewriteBase /
RewriteCond %{SERVER_PORT} ^443$ [OR]
RewriteCond %{HTTPS} =on
RewriteRule ^(.*)$ http://the-chess-forum.com/$1 [R=301,QSA,L]


Can anyone pleaseeeee help, thanks in advance

Oliver


Reply
#18
(01-08-2011, 02:16 AM)labrocca Wrote: index.php is part of the breadcrumb mainly so editing global.php does the trick.

$navbits[0]['url'] = $mybb->settings['bburl']."/index.php";

Thank you for this. It worked perfectly, and is cleaner than editing the htaccess.
[Image: sig.jpg]

Reply
#19
How to to use it in lighttpd which doest have .htaccess any tutorial please
Reply
#20
(06-14-2011, 05:16 AM)Johnrichardo21 Wrote: How to to use it in lighttpd which doest have .htaccess any tutorial please

Just read labrocca's method, a few posts above.

http://community.mybb.com/thread-77141-p...#pid628078
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)