网站重定向问题

网站重定向问题

问题描述:

I have been working on a website that is primarily PHP based. When a user visits the site stuff like http://robroscoe.ca/index.php, is redirected to http://robroscoe.ca and I am okay with this. What I am not okay with is, my webpages like robroscoe.ca/cv.php when you type in robroscoe.ca/cv redirecting back to robroscoe.ca. I am not sure how this happened and I am wondering if someone could explain to me what is going on.

# 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

I think the .htaccess file has something to do with this but I am not sure how to modify this as Wordpress seems to have created this for me without me knowing it. Any help or reading materials would be appreciated.

Thanks for your time!

You problem is that you've created a PHP script that is separate from WordPress and are trying to access it through a 'pretty' URL which WordPress handles. WordPress does not know of a page called 'cv', and handles it like any other 404.

I would strongly recommend that you create the page within WP so it can manage its own 'pretty URL' structure.

If you're hellbent on shoehorning your own scripts in, then get cozy with hand-editing your .htaccess file for each one.

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^cv/?$ cv.php [L]   #new rule
RewriteRule ^index\.php$ - [L]  #this is made redundant by the very next line.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>