Jump to content

Trying to rewrite URL


Bman900

Recommended Posts

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?

Link to comment
https://forums.phpfreaks.com/topic/198239-trying-to-rewrite-url/
Share on other sites

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

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.