Bman900 Posted April 11, 2010 Share Posted April 11, 2010 So I am trying to make my URL more search engine friendly so am trying to rewrite it but for some reason it is not working. Here is what am trying to do, make this: http://www.dezotech.com/more.php?article=Testing&id=4 look like this: http://www.dezotech.com/more/article/Testing/id/4/ Here is the code am trying to use: AddType x-mapp-php5 .php Options +FollowSymlinks RewriteEngine on rewritecond %{http_host} ^dezotech.com [nc] rewriterule ^(.*)$ http://www.dezotech.com/$1 [r=301,nc] RewriteRule more/article/(.*)/id/(.*)/ more.php?article=$1&id=$2 RewriteRule more/article/(.*)/id/(.*) more.php?article=$1&id=$2 The first part of the code works without a problem where it redirects to www. but when it comes to the bottom it does not work. Any ideas why? Quote Link to comment https://forums.phpfreaks.com/topic/198239-trying-to-rewrite-url/ Share on other sites More sharing options...
cags Posted April 12, 2010 Share Posted April 12, 2010 You didn't have a RewriteBase defined so the rewritten address probably wants to start from root. Try this... AddType x-mapp-php5 .php Options +FollowSymlinks RewriteEngine on rewritecond %{http_host} ^dezotech.com [nc] rewriterule ^(.*)$ http://www.dezotech.com/$1 [r=301,nc] RewriteRule more/article/(.*)/id/(.*)/? /more.php?article=$1&id=$2 Quote Link to comment https://forums.phpfreaks.com/topic/198239-trying-to-rewrite-url/#findComment-1040197 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.