I have wordpress installed in root directory. I want to use some separate php files as a page on my domain, for which I have made a separate directory which holds all files for serving the php files, of which the directory structure is as:
the root folder has all the wordpress files
the directory which I'd like to serve as a page
the CSS stylesheet files directory location in the PHP file is
one step back & then css folder.
I want to <strong>hide folders from URL</strong> such as the files are served from the root (hide the /inc/php/, /inc/css/ & /inc/img/ folders from URL).
eg: www.domain.com/inc/php/about.php <strong>redirect & rewrite this URL</strong> to www.domain.com/about
the
in my root
I have tried the simple redirect rule but the folders are exposed in the URL.
also I have some more files in the PHP folder on which I'd like to apply the same rule of <strong>redirect & rewrite URL</strong> & <strong>hide folders from URL</strong> & remove the PHP extention.
the root folder has all the wordpress files
the directory which I'd like to serve as a page
Code:
/inc/css/
/inc/php/
/inc/img/
the CSS stylesheet files directory location in the PHP file is
Code:
../inc/css
I want to <strong>hide folders from URL</strong> such as the files are served from the root (hide the /inc/php/, /inc/css/ & /inc/img/ folders from URL).
eg: www.domain.com/inc/php/about.php <strong>redirect & rewrite this URL</strong> to www.domain.com/about
the
Code:
.htaccess
Code:
RewriteEngine On
RewriteBase /
# disable directory browsing
Options -Indexes
# Prevent hotlinking of images htaccesstools.com/hotlink-protection
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?domain.com [NC]
RewriteRule \.(jpg|jpeg|png|gif|ico|pdf|flv|jpg|jpeg|mp3|mpg|mp4|mov|wav|wmv|png|gif|swf|css|js)$ - [NC,F,L]
RewriteRule ^login$ http://domain.com/wp-login.php [NC,L]
# 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
<files wp-config.php>
order allow,deny
deny from all
</files>
<files ~ "^.*\.([Hh][Tt][Aa])">
order allow,deny
deny from all
satisfy all
</files>
I have tried the simple redirect rule but the folders are exposed in the URL.
Code:
Redirect 301 /about.php /inc/php/about.php
also I have some more files in the PHP folder on which I'd like to apply the same rule of <strong>redirect & rewrite URL</strong> & <strong>hide folders from URL</strong> & remove the PHP extention.