0

Hi Everyone,
I have copied a .htaccess file from one website and I am trying to use the same htaccess file on a different website.

here is the copy of the htaccess file I have copied from one site to another...

<IfModule mod_rewrite.c>
  RewriteEngine on
  RewriteRule ^(\d+)/([^/]+)/?$ index.php?uiid=$1&title=$2 [L]
</IfModule>

both websites have the same structure as
/domname.com/dir1/dir2/shopping-cart/index.php
The htaccess file successfully rewrites the above url into the below url
/domname.com/dir0/dir1/shopping-cart/302/this-is-a-second-test-item

But for some reason, the htaccess file doesnt work & I get the error
The requested URL /domname.com/dir1/dir2/shopping-cart/index.php was not found on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

Can someone point me in the right direction with a fix to why this would not be working,
But, it works perfectly on the website I copied it from...

2
Contributors
1
Reply
15
Views
4 Years
Discussion Span
Last Post by LastMitch
0

@DaveyMoyes

Can someone point me in the right direction with a fix to why this would not be working,

Is dir0 and dir1 are URL keys? Then you need to create a new Mod for them. If those are not URL keys but a folder then you need to relink from the old one to the new one.

To rewrite as in URL Keys it should look something like this (it's not tested):

//Rewrite 1
RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^([^/]+)/([^/]+).html /index.php?uiid=$1&title=$2 [NC,R]

//Rewrite 2
RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^(.*)/(.*)\.html /index.php?uiid=$1&title=$2 [R=301,L]

Relink should be something like this (it's not tested either):

RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^dir0\.html$ "http\:\/\/www\.domname\.com\/dir0\.php" [R=301,L]

RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^dir1\.html$ "http\:\/\/www\.domname\.com\/dir1\.php" [R=301,L]

Edited by LastMitch: grammer

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.