Unable to open new pages expect index page in wordpress - php

I created a wordpress blog. Its is working fine in local.
When i copied the same to server expect index page nothing is working. i.e, when i open a new page(ex: "domain.com/contact") it throws "The requested URL /index.php was not found on this server.". I changed all the URL like site url, etc ..

you need to change in .htaccess file, text after "dRewriteRule".
i.e,
Before : dRewriteRule . /blog/index.php
After : dRewriteRule . /proj_folder/blog/index.php
Here "/proj_folder" is the project folder you kept "blog" files.
make sure that the link is correct.

Just to provide a clear answer based on Shakti's comment...
It looks like your WP installation is configured to use a custom permalink structure which requires mod_rewrite. It may be that your server does not support mod_rewrite, or the settings are not enabled in .htaccess.
Check that your .htaccess file was uploaded when you migrated the site and that the correct settings are present. If not you can disable custom permalinks by logging in to WP Admin, going to Options and Permalinks, then choosing the Default option.

Related

Change Startup Page of a WordPress website

I have an installed WordPress website.
I'm working on the site, therefore, I want to show a constructor page for the internet user. I have created a page which called first.html and I change the .htaccess file like below
#Alternate default index page
DirectoryIndex first.html
Now when I enter my domain name on the browser I can see the first.html. This is working properly.
I'd like to see my changes by entering the domain and page name on the browser like
www.mydomain/index.php
or
www.mydomain/wp-content/themes/XXXTHEME/index.php
However, my theme pages don't work.
How can I achieve to do this?
Instead of making changes in .htaccess, I'd suggest you to use this plugin : https://wordpress.org/plugins/maintenance/
Simply name your html file "index.html"
Web servers most commonly parse the index.html file firstly (unless told otherwise) and if it is not found, it proceeds to index.php
This also allows you to simply change that ".html" part to ".php" to see the website you are working on, without installing plugins that clutter your database or making unnecessary changes to your .htaccess file.

Wordpress not handling dynamic requests

I tried migrating my wordpress from xampp to a web server. Changed the site fields in the sql database, exported the database, updated wp-config, set permissions and uploaded the page.
The front page loads fine and I can access the admin page through /wp-admin (where everything functions) but any page request that isn't an actual file (like /admin) results in error 500.
I'm not sure how those work in PHP anyways. Is there some configuration I missed maybe? I also have access to php.ini if that helps.
Since I moved the deployment from /wordpress/ to htdocs root, I also had to edit the .htaccess file to change rewrite path.

Rewriting URLs in Joomla Component

I have a trouble in mod_rewrite redirect. I want to create friendly SEO links for my component. Now linkk looks like that:
http://www.mytestsite.com/index.php?option=com_mycomponent&task=show_posts&evid=11&Itemid=200&year=2013&month=10&day=15&title=this-is-really-test-article-here&uid=43840300d283724e77d5f33f19780f36&catids=15|16|17|18&filter_reset=1
I want to have:
http://www.mytestsite.com/posts/200-this-is-really-test-article-here
where first part of URL is itemid (200), and after article title.
How can i do that?
In Joomla, this is done in the administrator control panel by editing the site configuration (Site...Global Configuration). Click on the SEO tab and check the desired options, save and you're done.
If you need more options, try installing an SEO extension
Do make sure that you have a .htaccess file in the root of your web server home directory.
Also make sure that adequate file permissions are set, so that php/joomla can write to .htaccess and add mod_rewrite rules. I would recommend setting .htaccess file permission to 644. If that doesn't work, come back and ask again!
For Search Engine Keyword selection, this tutorial should be sufficient (skip to step 3): http://moz.com/blog/seo-your-joomla-website-in-11-super-easy-steps
A useful link to test if mod_rewrite is enabled on your webserver: http://docs.joomla.org/How_to_check_if_mod_rewrite_is_enabled_on_your_server

Wordpress causing "This webpage has a redirect loop" error remotely

I have a Wordpress site that works perfectly well in development (at mysite.dev), however when I deploy it to my remote server (mysite.com) it throws the 'This webpage has a redirect loop' error.
I can see in the loading bar that the browser is trying www.mysite.com then mysite.com then www.mysite.com again and again, however I'm not sure if this is relavant or not.
If my Wordpress database configuration is incorrect, I get the Error establishing a database connection message, however when everything is set correctly it breaks in this re-direct loop thing.
I have changed the field in the database (siteurl) to reflect the remote settings (http://mysite.com/wordpress).
Note: My wordpress files are stored in a folder called wordpress in my root directory except for wp-config.php, index.php and .htaccess.
Any ideas?
.htaccess contents:
# 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
index.php:
<?php
/**
* #package WordPress
*/
define('WP_USE_THEMES', true);
require('./wordpress/wp-blog-header.php');
?>
My hosted server settings were forcing mysite.com to www.mysite.com and this was causing the problem. I turned this setting off and everything works now, i'd still like to know how to make it work with this setting turned on, though!
I had the exact same problem (a redirection loop after migrating to a new server).
But it was not a problem with the configuration values siteurl and home, neither was it an issue with the .htaccess file. I tried all that. And it was also not a problem about the 'www' added to the URL.
After some researchs I found that the loop was caused by infinite calls to the redirect_canonical function (in wp-inclue/canonical.php).
But it was not a bug from wordpress. Some Php configs set the $_SERVER['REQUEST_URI'] in a "wrong way" when you acces your root url. Example : On my server, when I go to http://example.com/ the $_SERVER['REQUEST_URI'] is set to '/index.php' instead of just '/'
This is confusing for redirect_canonical because this function always try to redirect to the "better" url it knows for a page. And the better url for the root of your site is '/'. On my server, each time redirect_canonical tried to redirect to '/' it failed, and tried again until an infinite redirect loop was found.
To correct this bug, you can either modify your server configuration - I don't personnaly know how to do that, but I know it is possible - or if you can't change it, just add this code in a custom plugin :
/**
* avoid redirection loop in redirect_canonical if REQUEST_URI
* contains '/index.php'
**/
/* remove the action set in the hook 'template_redirect' by wordpress */
remove_action('template_redirect', 'redirect_canonical');
/* set a custom action in the hook 'template_redirect' to check REQUEST_URI value */
add_action('template_redirect', 'correct_redirect_canonical');
/* Function to correct the behaviour of redirect_canonical */
function correct_redirect_canonical(){
if(strstr($_SERVER['REQUEST_URI'],'/index.php')===false){
redirect_canonical();
}
}
Hope it helps !
1.- As "My wordpress files are stored in a folder called wordpress" you must edit RewriteBase and RewriteRule like this:
RewriteBase /wordpress/
RewriteRule . /wordpress/index.php [L]
UPDATE
2.- Try cleaning all cookies. This simple action (through Firebug) has solved this problem to me sometimes.
UPDATE 3
3.- Try this /index.php in your root directory:
// index.php file in root directory
chdir('wordpress'); // change dir to WP
include 'index.php'; // execute WP with their normal `index.php`
and leave /wordpress directory as usual (with their normal index.php and .htaccess inside).
I mean don't change any bit of the normal index.php of WP that it is something like this:
<?php
/**
* Front to the WordPress application. This file doesn't do anything, but loads
* wp-blog-header.php which does and tells WordPress to load the theme.
*
* #package WordPress
*/
/**
* Tells WordPress to load the WordPress theme and output it.
*
* #var bool
*/
define('WP_USE_THEMES', true);
/** Loads the WordPress Environment and Template */
require('./wp-blog-header.php');
Note that the infinite redirection problem can also occur when using CloudFlare Flexible SSL. To fix it you need to install the following plugin:
https://wordpress.org/plugins/cloudflare-flexible-ssl
Are you using a plugin like Redirection which tracks URL changes?
This might have created a loop where it redirects mysite.dev/page/ to mysite.com/page/ and mysite.com to mysite.dev.
Happened to me before!
This error can happen in one of two places, on the user side, or on the admin side.
When it happens on the admin side (wp-admin), you will find that you are unable to login.
Step 1: Connect to your blog using ftp and navigate to your wp-content/plugins/ directory and download all of your plugins to a folder on your desktop.
Step 3: Still in your FTP program, delete all plugin folders and php files in the plugins directory. You do not want anything at all left in this directory.
Step 4: Try logging into your blog. It should let you log in with no problems. Visit the plugins section of your blog. This should load with a lot of errors telling you that each plugin has been deactivated due to an error. This is ok.
Step 5: Using your ftp program you should upload all your plugins. Once uploaded you should activate each plugin one by one within wordpress and then visit the wp-admin/ login address to make sure that it will pass you through to your blog once logged in.
Step 6: When you activate a plugin and start getting this error again, you will know which one is to blame. Simply delete that plugin via ftp and start looking for an alternative plugin to use.
If these steps do not fix your problem, you should backup all your wordpress files and then delete them. You should them upload clean wordpress files for the latest version and try logging in with no themes or plugins uploaded. You can upload these later once you can login.
If you continue getting error, clear your browser cache, test logging in with other browsers.
If all else fails, contact your webhost or open a thread on the wordpress support forum
First of all I'm just a beginner so...
Meanwhile I think that I may have an alternative/shortcut to this issue.
Instead of deleting every plugin and then reinstalling all of them one by one I suggest to start by deleting the lasted plugins because "resent problem = recent modification/plugins"...
That is just my suggestion.
Marco Davide
Though I found this post and solution really helpful because this problem was driving me crazy and took me so much time to realize. In my case it happened because I moved the files inside the same server but using another domain and after finishing all configurations and replacements I was not able to view pages and got this error.
In my hosting settings there was a Preferred domain filed which was set to domain.ltd (I tried to change it but finally left it so) and than in Settings->General wordpress dashboard I had WordPress Address (URL) "mysite.com" and Site Address (URL) set to "www.mysite.com" after setting last value without www..bum everything is okay now. Hope this helps anyone else
in my situation, locally - Openserver.
The problem appeared in capital letters in the address. For example, in the site settings it was http://local-Host, it was the capital letters that caused the problem, because the entire address is reduced to lowercase letters - http://local-host, and as result $redirect_url was different from $requested_url in canonical.php
I had the same problem, the answer was the .htaccess file and the redirects there. It seems that the theme/plugins I was using wanted its own code which was similar to that on the wordpress site for htaccess. I looked through the plugin and found the code it referenced and changed that in the htaccess file. Now it works.

drupal rewrite is not working installed on subdomain

I have copied drupal from my main directory to anothre directory and created a sub domain but the url rewrite is not working.
I have checked mod_rewirte is enabled and allow override is set to all but I can not access pages except home page also I changed $base_url to point sub domain and also reflected in .htaccess.
Please advise what I can do from here also searched on net for this but nothing seems to be working
Thanks
If you cannot log in to turn off clean urls and you have access to the database you can edit the setting in the database.
in the 'variables' table find the row 'clean_urls' and delete the row. Then when the setting is checked it uses the default which is OFF.
In my experience this breaks when you move Drupal but miss the .htaccess file. Or if it is moved into a directory that forsome reason has AllowOverride turned off in apache settings.

Categories