301 redirect html to index.php file from existing .htaccess file
I trying to create some 301 redirects for a friend. His old site was a static site built with a few html pages.
He got a new site built by a developer and would like me to have his old urls redirected to the equivalent page on his new site. If the new site does not have an equivalent page, he would like to have it redirect to the front page.
The old site only had 9 or 10 pages so writing a line in the .htaccess file for each redirect is not a problem for me.
The problem is I have tried everything possible to get a redirect to work using the .htaccess file created by the developer of his new site, with no luck.
The current .htaccess file contains the following lines
RewriteEngine on
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^(.*)$ /~example.com/index.php/$1
I have tried all sorts of stuff found on on this site and on google. for example, I would be happy if I could get this to work
RedirectMatch 301 (.*)\.ht开发者_运维技巧ml$ $ /~example.com/index.php/$1
I tried putting that line above the existing RewriteCond but below the existing RewriteEngine line and also tried putting it at the bottom below all the existing lines, but no go. every example I have found does not work. I keep getting a 404 page no matter what I do.
I am a front end guy with no knowledge of Apache and small knowledge of frameworks outside of Drupal and wordpress but It appears that this site is a custom CMS built with the zend framework. The site has an admin interface for creating new pages but has very little options and definitely no option to create redirects. Any ideas?
oh, one more thing. I know that I am in the web directory because if I remove the index.php file the base url returns a 404.
RewriteEngine on
RedirectMatch 301 /(.*?)\.html$ /~example.com/index.php/$1
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^(.*)$ /~example.com/index.php/$1
精彩评论