Wordpress always load same page - index.php - php

I have a Wordpress website with a custom theme. Everything works fine on index.php but when I create one more page (index2.php or adminpage.php) and try to load that in-browser WordPress will redirect me to index.php
OK, this is file setup: https://ibb.co/9n7Qdxt . This is URL of normal index.php: https://ibb.co/M69f5bD . And this is a problem: https://ibb.co/kJFW4ZZ
ps: adminpage.php is empty but browser load index.php
image: https://ibb.co/x2T82dc
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
<META HTTP-EQUIV="EXPIRES" CONTENT="Mon, 22 Jul 2002 11:12:01 GMT">
<link rel="icon" href="favicon.ico">
<link rel="icon" href="favicon.png">
<title></title>
<?php wp_head(); ?>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link href="https://fonts.googleapis.com/css?family=Lato:100,100i,300,300i,400,400i,700,700i,900,900i" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Libre+Franklin:100,100i,200,200i,300,300i,400,400i,500,500i" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Montserrat" rel="stylesheet">
</head>
PRoblem: Wordpress always redirects the user to index.php regardless which url user enter ...

From what you've described you haven't added the adminpage.php as a template file and assigned it to a page in the backend. Here's a link to help you with template theming in WordPress.
https://developer.wordpress.org/themes/basics/template-hierarchy/

Related

Can't reach css files laravel-9

I am building a website. in index page everything works. But I tried to add page. At service page, I can reach the content but it is unstyled.
My index file starts like this
#extends('layouts.frontbase')
#section('title', 'Pasa Law')
#section('content')
#include("home.slider")
My service file is same
#extends('layouts.frontbase')
#section('title', $data->title)
#section('content')
<p>{{$data->detail}}</p>
#endsection
When I open site css and javascript files are okey in index
index page
But when I open service site it has problems with css
service page
Frontbase.blade.php
<html>
<head>
<title>#yield('title')</title>
#yield('head')
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<meta name="copyright" content="Kaan Pasa, https://github.com/kaanpasa">
<title>#yield("title")</title>
<link rel="stylesheet" href="assets/css/maicons.css">
<link rel="stylesheet" href="assets/vendor/animate/animate.css">
<link rel="stylesheet" href="assets/css/bootstrap.css">
<link rel="stylesheet" href="{{asset('assets/vendor/owl-carousel/css/owl.carousel.css')}}">
<link rel="stylesheet" href="assets/css/theme.css">
<!-----Slider CSS--->
<link rel="stylesheet" href="/assets/css/owl.theme.default.min.css">
<link rel="stylesheet" href="assets/css/ionicons.min.css">
<link rel="stylesheet" href="assets/css/style.css">
</head>
<body class="bg-light">
#include("home.header")
<div class="container">
#yield('content')
</div>
#include("home.footer")
#yield('foot')
</body>
</html>
If your link is
link rel="stylesheet" href="/css/styles.css"
try
link rel="stylesheet" href="{{ asset('css/styles.css') }}"
and put your css files in the public folder e.g
public|->css|->styles.css

GET http://localhost/bootstrap.min.css net::ERR_ABORTED 404 (Not Found)

In Php when I try to load the page and this error appears in the console: GET http://localhost/bootstrap.min.css net::ERR_ABORTED 404 (Not Found). || js and css don't work on my web page
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Home Page</title>
<link rel="stylesheet" href="/bootstrap.min.css">
<link rel="stylesheet" href="/style.css">
</head>
but the path is correct, even though i had a 404 problem...
what'the problem?
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
In CDN It worked, but in local files(downloaded files) not worked.

bootstrap, css, or responsive not working in mobile as well as pc

my website is constructed using PHP. If I visit on this page
www.xyz.com/post.php
then this is work correctly in mobile as well as pc. If I visit on this page
www.xyz.com/post/23/what-is-php
then bootstrap not loading in both devices.
if I use the base href and meta viewport... something like this below
<base href="http://localhost/postblog/post.php">
<body style="background-color: #EAEAEA">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no">
then its work only in pc but not in mobile device...this is the problem
full head code
<head>
<base href="http://localhost/postblog/post.php">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">
<title>Blog Home - Start Bootstrap Template</title>
<!-- Bootstrap core CSS -->
<link href="home/vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<!-- Custom styles for this template -->
<link href="home/css/blog-home.css" rel="stylesheet">
I use the httpaccess for frindly url...i think problem is arising for this
remove shrink-to-fit=no
<meta name="viewport" content="width=device-width, initial-scale=1">
add a slash to get content from home
<!-- Bootstrap core CSS -->
<link href="/home/vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<!-- Custom styles for this template -->
<link href="/home/css/blog-home.css" rel="stylesheet">
shrink-to-fit=no will just let any overflow fall off the screen. I would recommend trying without.

Why can't PageSpeed Insights see my Viewport Meta Tag?

I've added the code
<meta name="viewport" content="width=device-width, initial-scale=1" />
to the HEAD of my webpage the Index.php at DuchyBrass.co.uk
It is on Line 6 of the source code, but the site runs on a bespoke CMS so the HEAD is defined in its own file and imported.
index.php
<!DOCTYPE html>
<html lang='en'>
<head>
<?php include 'app/common/head.php'; ?>
</head>
<body>
...
head.php
<title>Duchy Brass</title>
<meta charset="windows-1252" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="google-site-verification" content="QsU348JA47VLcAbTUic-Un90bVlGuVk3a9A34doxsvc" />
<link rel="stylesheet" type="text/css" href="css/style.css">
<link href='http://fonts.googleapis.com/css?family=Viga' rel='stylesheet' type='text/css'>
<link rel="icon" type="image/png" href="imgs/favicon.ico">
<link rel="canonical" href="http://www.duchybrass.co.uk" />
As far as the browser is concerned (I assume) that viewport tag is visible, but it is not seen by that Mobile SEO tool. Is this something to do with the CMS, loading the information too late, or is this a common issue that I should ignore?
The top of my Index page (using view page source from the browser) looks like
/ (page source)
<!DOCTYPE html>
<html lang='en'>
<head>
<title>Duchy Brass</title>
<meta charset="windows-1252" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
...
TL;DR: clear caches and check if there is no content before head (ctrl+U)
I had a similar problem, in my case there were content being included trough PHP before my wordpress header call,
check it with Ctrl+U (see source) and be sure there is nothing before the
<!DOCTYPE html>
<html lang='en'>
<head>
if you change the code and it persists, check if you're using cache, you may have to clear caches of pages and files so the changes take effect before running another PageSpeed analysis

Adding header tags ruins my template?

I have added an availability calendar to my website which I found online, the header tags are below:
<link rel="stylesheet" href="assets/style.css">
<link rel="stylesheet" href="assets/dateTimePicker.css">
    <script type="text/javascript" src="scripts/components/jquery.min.js"></script>
    <script type="text/javascript" src="scripts/dateTimePicker.min.js"></script>
When I add them to my current website page, it changes the template and ruins the look by either adding blank white space at the top of the page or affecting the nav bar whenever I add the script? Any ideas how I can have the script without it affecting my template?
Here is my template html with the script added...
<!DOCTYPE HTML>
<html>
<head>
<link rel="stylesheet" href="assets/style.css">
<title>Dave's Caravan Letting</title>
<link href="css/style.css" rel="stylesheet" type="text/css" media="all" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href='http://fonts.googleapis.com/css?family=Rochester' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="assets/style.css">
<link rel="stylesheet" href="assets/dateTimePicker.css">
    <script type="text/javascript" src="scripts/components/jquery.min.js"></script>
    <script type="text/javascript" src="scripts/dateTimePicker.min.js"></script>
</head>
By adding random code to existing code can cause code conflict, first understood the existing css code and than add the additional css code.
If you want to debug then open the site in browser's developer tool, check out the portion's css using inspect element and correct or rectify the css code.
Use the following link to learn how to use developer tool
https://developer.chrome.com/devtools

Categories