Hi there, I wonder if you can help me out.
I'm trying to create clean URLs and so far I've managed to use .htaccess to convert the following URL:
into:
The problem is then getting PHP to interpret the URL and extract the variables. Here's the code I'm using:
.htaccess code:
PHP code:
With this I keep getting a 404 error page. If I add index.php into this line of the htacces code:
The page at least loads, but the css and images are not loaded.
Any suggestions to what I'm missing here?
Many thanks
I'm trying to create clean URLs and so far I've managed to use .htaccess to convert the following URL:
into:
The problem is then getting PHP to interpret the URL and extract the variables. Here's the code I'm using:
.htaccess code:
Code:
Options +FollowSymLinks Options +Indexes RewriteEngine on #INTERNAL STATIC URL TO DYNAMIC URL RewriteRule ^/([^/]+)/?$ /index.php?c=$1 [L] RewriteRule ^/([^/]+)/([^/]+)/?$ /index.php?c=$1&p=$2 [L] #EXTERNAL DYNAMIC URL TO STATIC URL RewriteCond %{THE_REQUEST} ^[a-zA-Z0-9]{1,3}\ /index\.php\?catagory=([^&]+)\ HTTP/ RewriteRule ^index\.php$ http://www.example.com/%1/? [R=301,L] RewriteCond %{THE_REQUEST} ^[a-zA-Z0-9]{1,3}\ /index\.php\?catagroy=([^&]+)&page=([^&]+)\ HTTP/ RewriteRule ^index\.php$ http://www.example.com/%1/%2/? [R=301,L]
Code:
$urlVariables = explode("/",$_SERVER['REQUEST_URI']); $catagory = $urlVariables[1]; $page = $urlVariables[2];
Code:
RewriteRule ^index\.php$ http://www.example.com/[B]index.php[/B]/%1/? [R=301,L]
Any suggestions to what I'm missing here?
Many thanks
Comment