0

Please help with setting/config of .htaccess file.

How to Rewriterule from address http://domain.com/main_page to http://domain.com ?

What i do or my .htaccess file:

RewriteEngine on
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

I tried RewriteRule ^$ /Main_Page but it doesnt work.

nalply
  • 26,770
  • 15
  • 78
  • 101
  • Possible duplicate of [How to prevent MediaWiki from redirecting the main domain to the "Main Page"?](http://stackoverflow.com/questions/26283433/how-to-prevent-mediawiki-from-redirecting-the-main-domain-to-the-main-page) – Nemo Nov 08 '15 at 08:42
  • The solution nowadays is http://laxstrom.name/blag/2015/08/31/mediawiki-short-urls-with-nginx-and-main-page-without-redirect/ – Nemo Nov 08 '15 at 08:42

1 Answers1

1

I see three errors:

First: You try to redirect back to front.

RewriteRule ^$ /Main_Page

would redirect http://example.com/ to http://example.com/Main_Page.

Second: For your simple case the RewriteCond directives are superfluous. They check if the request file name does not exists as a file nor as directory. But you only want to redirect /main_page to /.

Third: URLs are case sensitive. On Windows web servers this does not matter. But your setup seems not to run on a Windows web server. If you really need case-insensitive redirecting, this is another question. See Case Insensitive URLs with mod_rewrite.

Community
  • 1
  • 1
nalply
  • 26,770
  • 15
  • 78
  • 101
  • Yeah i use Apache and i still tryin redirect from http://domain.com/Main_Page to http://domain.com and it doesnt work. do you can help with it ??? Probably some example or case as similar on that. with best regards – Alex Machoun Sep 30 '12 at 16:02
  • Try #9 with this code - RewriteCond %{REQUEST_URI}!redirecter RewriteRule (.*) [domain.com] [L] – Alex Machoun Sep 30 '12 at 16:11
  • This is a very basic question. StackOverflow is not the right place to get support for your problem. You need to learn the basics of URL Rewriting, then if you are stuck on a mildly hard problem, return here. – nalply Sep 30 '12 at 16:56
  • I kno dat StackOverflow is not place for support Mr. Nalply. i just think someone has a similar situation . Learning and learning , im dig on docs of Apache settings. Anyway thanks man. – Alex Machoun Sep 30 '12 at 17:16
  • Fourth, this will get you into a redirect loop as MediaWiki redirects from `/` to `/Main_Page`. When you don't have a clear understanding of how a system works, it is wiser to ask how you can achieve goal X, than to ask how you can do Y which you think is the way to achieve goal X - you are just not very good at turning goals into concrete steps at this point. – Tgr Oct 01 '12 at 09:17