Index.php does not load automatically when site is opened - .htaccess

I uploaded to my wordpress files, have gotten all the configuration issues straightened out and it now works fine, but only if I enter the full address - www.mydomain.com/index.php
If i try to enter just www.mydomain.com it does not load.
Why is it not automatically loading index.php when the site is accessed?

Default wordpress .htaccess is this:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
Make sure to drop that into the same directory of your site that contains the wp-content etc. folder.
If that doesn't help, then check in your general settings to make sure that your website isn't pointing to /index.php etc. Example screen below:

Add this to your .htaccess, so it looks something like this at the end:
RewriteRule . /index.php [L]
</IfModule>
DirectoryIndex index.php Index.php
# END WordPress
This htaccess snippit is based off the one Ian says is default for wordpress. It may vary for Plsek Panel. This is another page that could help: http://support.hostgator.com/articles/specialized-help/technical/apache-htaccess/directory-index-for-plesk-for-linux
(This post has been edited beyond recognition from its original state)

Related

How to cancel an .htaccess rewrite to a subfolder?

I want to cancel an .htaccess rewrite that redirects people from mysite.com to mysite.com/blog.
I previously wanted to bypass the main page and send users straight to a subdirectory, so I added a rewrite. Now I want people to be able to access mysite.com, but still be able to reach mysite.com/blog (but only when they follow a link to mysite.com/blog, not by default). I'm a beginner to .htaccess, so I appreciate the patience and help.
Here's what was in my .htaccess:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www.)?dreamybeast.design$
RewriteRule ^(/)?$ blog [L]
I thought that just commenting out my rewrite code in the .htaccess file would stop the site from redirecting mysite.com to mysite.com/blog, but I'm still not able to land on mysite.com at all.
I also tried deleting the .htaccess file (there was nothing else in it) and I still can't land on the root url.
--- edit ---
There's an .htaccess file in the blog subfolder (which contains a Wordpress install) with the following code in it:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /blog/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]
</IfModule>
# END WordPress
Is it possible that this is what's causing the redirect, not the .htaccess file in the root?

.htaccess RewriteRule seems not to work

I got a problem with my .htaccess here and altough I searched the web and tried many things, I could not find any solution...
I have a wordpress-installation with enabled permalinks. Additional to that, I need to rewrite another URL on this wordpress-installation, which does not belong to WP.
If a user browses to http://www.URL.com/?page_id=30&tag=all&filterCategory=6\%23Jackets, I'd like to show http://www.URL.com/jackets.html as URL. There should also be the possibility to directly browse to http://www.URL.com/jackets.html.
My .htaccess looks like this
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
RewriteRule ^jacket\.html$ http://www.URL.com/?page_id=30&tag=all&filterCategory=6\%23Jackets [L]
</IfModule>
# END WordPress
Does anyone have any idea why this does not work?
The WordPress rewrite rules are redirecting any requests to non-existant files through WordPress. The rewrite rule responsible for this, RewriteRule . /index.php [L], is marked with [L], indicating that no more rules are to be processed after it. In order for your rule to work, it must be placed before the WordPress rules, but after the line RewriteBase /.

Redirect subdir with .htaccess

My first question here! :) Hello!
I have some trouble with .htaccess.
http://www.domain.com/subdir/?parameter=example works.
http://www.domain.com/subdir/example doesn't work.
When i try this:
RewriteBase /subdir
RewriteRule ^index.php - [L]
RewriteRule ^([^/]+)/?$ index.php?i=$1 [R,L]
i get an 404.shtml error like http:// www.domain.com/subdir/index.php?i=404.shtml
Also the wp-admin(http:// www.domain.com/wp-admin/) redirects to the subdir with 404.shtml. How do i get the url like http:// www.domain.com/subdir/example/
Can anyone help me?? Thnx in advanced!
Assuming this is a WordPress installation (based on the mention of 'wp-admin'), you want the following
Just use the WordPress standard, put this .htaccess into the root folder
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /subdir/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /subdir/index.php [L]
</IfModule>
Go to Settings and change Site address (URL) under General Settings to http://www.domain.com/subdir/
Put the following index.php into the root folder
<?php
define('WP_USE_THEMES', true);
/** Loads the WordPress Environment and Template */
require('./subdir/wp-blog-header.php');
?>
Go to Settings > Permalinks and change the permalink structure to whatever you need
p.s. to access wp-admin you need to navigate to http://www.domain.com/subdir/wp-admin/
more info here: http://codex.wordpress.org/Moving_WordPress#Giving_WordPress_its_Own_Directory_While_Leaving_the_WordPress_Index_File_in_the_Root_Directory

Wordpress Rewriterule / Redirection

Guys i'm facing an issue regarding wordpress redirection.
I've used .htaccess on my website and i wish to make this work also for wordpress pages.I've installed wordpress in a folder named as "blogs" on the root like /blogs
I've also integrated/made changes in search.php of wordpress (domainname.com/blogs/wp-content/themes/my_theme/search.php) to my requirements. When someone searches the form action goes some thing like this:
http://www.domainname.com/blogs/?s=keyword
This works fine but I want to use rewrite rule over this something like:
www.domainname.com/blogs/blog-keyword with http://
but it brings user to 404.php page of wordpress
my current htaccess file contains the following code under the blogs directory of root:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /blogs/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blogs/index.php [L]
# Pads Landing / Searching Page
RewriteRule ^blogs/movie-(.*) /pads/?s=$1
</IfModule>
# END WordPress
Kindly help me I've few mins left for project deadline.
Thanks in advance.
Ok...
Check into Options -Multiviews
I've noticed issues when using wordpress
I use it like so
Options +FollowSymlinks
Options -Multiviews
RewriteEngine on
So
RewriteRule ^pads/movie-([^/]+)$ "http://%{HTTP_HOST}/pads/?s=$1" [R=301,L]
Hope it works. Lemeknow

How to redirect requests to example.com to www.example.com with mod_rewrite?

This is my .htaccess generated by wordpress that sits in my root directory.
I need to modify/add to it, to direct all incoming traffic to www.example.com, instead of example.com.
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
If someone wants to explain what all the above does also, that would be appreciated as well.
To do what you requested, you want to add:
RewriteCond %{HTTP_HOST} ^www.mysite.com$ [NC]
RewriteRule ^(.*)$ http://mysite.com/$1 [R=301,L]
You can place that inbetween the <IfModule mod_rewrite.c> brackets after RewriteBase
As for what Wordpress' htaccess code does (didn't test it): It seems to test for any direct links to files and directories and not pass them through the RewriteRule which will normally take your link and send it to index.php
So if your link is for www.mysite.com/some/page, it makes sure /some/page isn't a direct file link or an actual web directory and if it isn't, then it passes the request to index.php which parses it to display the correct Wordpress page.

Resources