index.php is bypassed in wordpress local install - wordpress

hello I have a local wordpress installation, which is a copy of my hosted website.
i'm going to try to make it simple :
If i type "http://mylocalwebsite/index.php", it works and shows me my local copy
If i type "http://mylocalwebsite", index.php is still used, but i'm ending in my hosted web page (www.myrealsite.com)
If i type "http://mylocalwebsite" again, it doesn't use index.php, and directly opens my hosted website.
All hosts files are correct, none of them is leading to my hosted website.
I've done a search for "www.myrealwebsite.com" in the directories of the local copy : no result.
I just don't understand why. Any ideas ?
Thx

This is a cached redirect from the browser you are using (since the hostname you are using is not FQDN, the browser tries to correct that, or has previously seen a (301) redirect to the real webpage like from non-www hostname, to a www.hostname and uses that to assume what is correct).
If you try the same with CLI curl request, I would imagine the result will be as you expect.

Related

Wordpress : To load all asset files coming from HTTP to HTTPS?

I'm using Wordpress HTTPS plugin to force Admin mode to run under HTTPS.Its fine for Admin Panel.
But still, once i'm under HTTPS mode, every front pages are broken because of, it is saying some front-pages Asset Files are coming as normal HTTP (without 'S') which are then getting blocked to load onto page.
Than resulted in rendering the page looking messy.
So to be more clear again,
When i call the site in HTTPS / SSL mode .. some asset files, like:
http://www.my-another-site.com/something.js
http://www.my-another-site.com/something.css
http://www.my-another-site.com/something.jpg
... etc
.. are BROKEN. (Because i'm in https mode and those above files are coming as http)
So how to make Wordpress to FORCE LOAD those whatever files?(I DON'T CARE WHETHER IT IS SECURE OR NOT. Just want the site under https://... to be rendering properly.)
You could try using a protocol relative URL (dropping both the http and https from the URLs) - see this answer.
According to this answer you'll need to be on a recent version of WordPress (I'd assume 3.5) for it to work with wp_enqueue_script.

XAMPP wordpress on localhost

I have this site and I need to test it out locally to see if there is an issue with my php settings, anyways I tried to navigate to localhost with the port number localhost:portnumber
and that worked fine, but then I tried to navigate to my site localhost:portnumber/mysite and I get a 404 error and the in the the address i navigate to changes to localhost:portnumber/mysite
Why is this happening and what can I do to fix it?
Thanks
Because you are getting a 404 error, your server seems to be running but make sure the server is the one you have setup.
1st, have you tried using a simple html file? example: blabla.html on root, and typing: localhost:portnumber/blabla.html
If this is working, that means your server is running fine, you can also try with an Hello world php file if you wish.
In the case of wordpress, there is sometime a .htaccess file that uses url rewrite and it may remove your port number, you could try to test with a clean wordpress install first.

Prioritize folders in URL rewrite for IIS7

We are currently using CommunityServer for our website.
A recent change called for the creation of a shorter URL to access a user's profile page. So if our site is www.example.com, we want the user profile page to be accessible via www.example.com/username.
To make sure that existing folders/paths are prioritized, I placed the rewriting rule at the very end in SiteUrls.config:
<Override xpath = "/SiteUrls/locations/location[#path='/']" mode="add" where="end">
<url name="userslug" path="" pattern="/([a-zA-Z0-9\-]+$)" physicalPath="/user/" vanity="{2}?slug=$1" page="userprofile.aspx" />
</Override>
This worked quite well while testing in my local environment via VS2010 Debug. Accessing www.example.com/folder gets redirected to www.example.com/folder/ and the default page is shown properly.
However, when we deployed the change to live, accessing www.example.com/folder returns a user not found error, which just means that looking for an existing folder was not prioritized somehow.
I'm not sure what relevant information to give from our live server, but is there anything I should take a look at to make the URL access work like how it is in VS2010 Debug?
Apparently, all you got to do is to create a URL Rewrite rule to add trailing slashes to directories via IIS.

Drupal migration - now only front page works

I just migrated a Drupal site from a ISP
to a dedicated Linux CentOS server.
MySQL Database is configured and generates front page without error.
Problem is that only the home page works.
All other pages show "404 Page Not Found Error".
So mysite.com/ works
but mySite.com/node/1 does not work.
I checked some obvious places:
LoadModule rewrite_module modules/mod_rewrite.so
is enabled in httpd.conf
Any ideas?
I've had this happen before. It could be because your new Linux Centos OS server isn't configured for clean URLs yet.
Try to access the site as follows. To login:
http://example.com/?q=user/login
Login as admin and submit the form. You'll get access denied 404 page again after submission but still login.
Now manually type and go to http://example.com/?q=admin/settings/clean-urls
On this page turn off clean-urls and save and you should be able to access your site normally on the new server. Just configure it for clean-urls and then turn it back on when it's ready.
thanks Kevin,
mysite.com/?q=node/1? gives me a 404.
.htaccess was indeed missing. I copied in a generic version from a
vanilla install into root directory (same directory as index.html) and this does not help.
(I don't have access to old site. We did not modify .htaccess - so I assume vanilla copy will do)
Another possibility: If it's a new server, make sure that Apache has mod_rewrite installed. Happened to me.
If you have drupal 7 or higher use this for the clean-url config page:
mysite.com/?q=admin/config/search/clean-urls
Check to see that the .htaccess file made it through the migration. Usually the culprit here. Can you get to mysite.com/?q=node/1?

Redirect issues

Whoever wrote the navigation for the site I’m currently working on (classic asp) points the navigation links to a folder, then inside to folder has an index.asp file, so the urls will look something like this www.mysite.com/myfolder/mysubfolder
Now, when watch the page load using httpfox, I notice that the first entry is a 302 redirect to the same address with a “/” on the end, so www.mysite.com/myfolder gets redirected to www.mysite.com/myfolder/ (note the / on the end).
I’m not to worried that it’s a 302 since its in the admin section of the site, but when I forward the host headers from ISA server, for an https request, its being redirected from https://www.mysite.com/myfolder to http://www.mysite.com:443/myfolder/ and causing all kinds of problems.
Anyway, I can’t seem to find any code making this redirect happen, so does IIS 6 do this because the url points to a folder? Or do I need to comb through the code more closely?
the problem is not in the code.
the redirect happens because there is no url "https://www.mysize.com/myfolder".
correct urls look like this: "https://www.mysize.com/myfolder/"
so the last / is important and only with this you have a valid url!
the webserver now is cute enough to automatically send a "302 found (originally temporary redirect, but now commonly used to specify redirection for unspecified reason)" status code.
just add the / to the links and you're fine

Resources