I can’t solve the problem anyway,
Redirects to home page even though I enter a direct URL
It prevents me from accessing the admin panel
login.php
reset.php
register.php
I remove the extension of 3 files as above with the code at the bottom
(other php files exist but they will remain)
For the pages in the menus on the homepage, I pull the page contents from the database as “index.php?p=page-page”
The following code converts the url “index.php?p=page-page” to “com/page-page”
That’s all, how do I get access to the admin panel?
What are the errors in the codes below for me
I ask for your help
Thank you
<IfModule mod_rewrite.c>
Options +MultiViews
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://xxxxxxxx.com/$1 [R,L]
# Except for the administration panel folder
RewriteCond %{REQUEST_URI} !^/administrator/
# Remove index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{THE_REQUEST} ^GET.*index\.php [NC]
RewriteRule (.*?)index\.php/*(.*) /$1$2 [R=301,NE,L]
# Remove ?p=
RewriteCond %{THE_REQUEST} ^GET\ /\?(([^&\s]*&)*)p=([^&\s]+)&?([^\s]*)
RewriteRule ^(.*)$ /%3?%1%4 [L,R=301]
# Craft 404
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]
RewriteRule (.+) index.php?p=$1 [QSA,L]
# Remove extension of specified files
RewriteCond %{THE_REQUEST} \s/+(login|register|reset)\.php[\s?] [NC]
RewriteRule ^ /%1 [R=302,L,NE]
</IfModule>
I am using this code in index.php on homepage
if(isset($_GET['p'])){
$get_url_name = filter_input(INPUT_GET,'p');
$page = $pdo->prepare("SELECT get_url_name, homepage FROM front_pages WHERE get_url_name=?");
$page->execute([$get_url_name]);
$read_content = $page->fetch();
$homepage = $read_content['homepage'];
}else{
$page = $pdo->prepare("SELECT get_url_name, homepage FROM front_pages WHERE homepage=?");
$page->execute([1]);
$read_content = $page->fetch();
$homepage = $read_content['homepage'];
$get_url_name = $read_content['get_url_name'];
}