I am currently making a website (http://tannernelson.me/ehs)
It’s hosted on Godaddy, and I’m using wordpress as a CMS.
I want to be able to make:
http://tannernelson.me/ehs/school/academics/teachers/jsmith
turn into
http://tannernelson.me/ehs/index.php?pagename=teachers&detail=jsmith
So, basically, if there are 4 segments to the url (school/academics/teachers/jsmith) I want the last one to be a variable. So the fourth segment of any url will be the variable “detail”
My current URL rewrite is currently
# Mod Rewrite
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /ehs/index.php [L]
Options -Multiviews
It won’t work any other way, even with the default WordPress .htaccess file. And I have no idea what that means, or what kind of request URI is made out of it. It’s really confusing.
Any ideas?
The code you have right now means:
If the requested filename is not (
!
) a regular file-f
and if the requested filename is not (!
) a directory-d
then:Match any single character (
.
) and if a match is found rewrite the URL to/ehs/index.php
and then make this the last rule ([L]
) so don’t process any further rules.This doesn’t look like what you want, but seems to be working.
http://tannernelson.me/ehs/school/academics/teachers/jsmith
serves up (I think)http://tannernelson.me/ehs/index.php
because I get a custom 404 not found page.Try the following
.htaccess
code:I just tested this on my Apache server and it works.