Search the Community
Showing results for tags 'clean url'.
-
So I have the below code doing two things. The first part removing .php extension from urls and the second part redirecting from a clean url to the original. Its the second part of this that is not working and I dont know why and am hoping and praying someone here can help with this. I have tried many different tutorials with different approaches and still no luck. Below is the most basic of the attempts I have tried and from what I can tell it SHOULD work, but alas... Anyway its trying to get the clean url example.com/post/2 to redirect to example.com/post.php?id=2 Please help! RewriteEngine On #remove .php extension RewriteCond %{REQUEST_FILENAME}.php -f RewriteCond %{REQUEST_URI} !/$ RewriteRule (.*) $1\.php [L] #redirect RewriteRule ^/post/([0-9]+)$ /post.php?id=$1
-
Hi guys, I'm new to this site so thought I'd start off with a question regarding something I've been wanting to fix for ages!! We have a custom CMS on our website that produces URLs based on the title of the news article and leaves spaces between the words. For example an article called 'News article title' creates a link like this: <a href="article.php/<?php $news->Title()?>"> Which results in the browser seeing a link like this: http://www.ourwebsite.com/article.php/news article title and once clicked turns to this in the browser: http://www.ourwebsite.com/article.php/news%20article%20title Obviously i'd prefer it to look like this: http://www.ourwebsite.com/article.php/news-article-title I have played around with .htaccess and can get it to change the gaps into dashes, but seeing as the page isn't titled with dashes the link fails... I'm guessing I need to modify my link in the PHP, but this is where my lack of experience shows!! Any advise on how I can change the above to make the URL's cleaner and more SEO friendly would be appreciated!! Simon