Jump to content

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

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.