Page 1 of 1

Please help with the .htaccess YIKES!

Posted: Fri Apr 27, 2007 11:09 am
by soulja90
I'm trying to redirect my original .html pages to the new SEO friendly links i have going on.

This is what happens:

redirect 301 /american-dropshipper.html http://www.wdclub.com/


Gives me this result:

http://www.wdclub.com/?page=american-dropshipper.html

Instead of going to the homepage, how can i fix it.

My current .htaccess file:

Options +FollowSymLinks
RewriteEngine on
RewriteBase /


# 301 Redirect all requests that don't contain a dot or trailing slash to
# include a trailing slash
RewriteCond %{REQUEST_URI} !/$
RewriteCond %{REQUEST_URI} !\.
RewriteRule ^(.*) %{REQUEST_URI}/ [R=301,L]

# Rewrites urls in the form of /parent/child/
# but only rewrites if the requested URL is not a file or directory
RewriteCond %{REQUEST_FILENAME} !-f [NC]
RewriteCond %{REQUEST_FILENAME} !-d [NC]
RewriteRule ^(.+)$ index.php?page=$1 [QSA]

PLESE HELP

Here is my config section

#------------
#URL Settings
#------------

#Show mod_rewrite URLs in the menu? You must enable 'use_hierarchy' for this to work for modules
$config['assume_mod_rewrite'] = true;

#Extension to use if you're using mod_rewrite for pretty URLs.
$config['page_extension'] = '/';

#If you don't use mod_rewrite, then would you like to use the built-in
#pretty url mechanism?  This will not work with IIS and the {metadata} tag
#should be in all of your templates before enabling.
$config['internal_pretty_urls'] = true;

#If you're using the internal pretty url mechanism or mod_rewrite, would you like to
#show urls in their hierarchy?  (ex. http://www.mysite.com/parent/parent/childpage)
$config['use_hierarchy'] = true;

#If using none of the above options, what should we be using for the query string
#variable?  (ex. http://www.mysite.com/index.php?page=somecontent)
$config['query_var'] = 'page';

PS: I've read the documentation but to no avail. Thanks JB

Re: Please help with the .htaccess YIKES!

Posted: Fri Apr 27, 2007 12:05 pm
by skypanther
Here's what I use for the .htaccess

Code: Select all

Options +FollowSymLinks
RewriteEngine on
RewriteBase /

# 301 Redirect all requests that don't contain a dot or trailing slash to
# include a trailing slash
# RewriteCond %{REQUEST_URI} !/$
# RewriteCond %{REQUEST_URI} !\.
# RewriteRule ^(.*) %{REQUEST_URI}/ [R=301,L]

# Rewrites urls in the form of /parent/child/
# but only rewrites if the requested URL is not a file or directory
RewriteCond %{REQUEST_FILENAME} !-f [NC]
RewriteCond %{REQUEST_FILENAME} !-d [NC]
RewriteRule ^(.+).html$ index.php?page=$1 [QSA] 
Also, I think you need to change this:

#Extension to use if you're using mod_rewrite for pretty URLs.
$config['page_extension'] = '/';

to something like this:

#Extension to use if you're using mod_rewrite for pretty URLs.
$config['page_extension'] = '.html';

Whatever you use for this value gets tacked onto the page alias names, which means you have to include the dot. I believe you can use whatever you want (.asp, .htm, .php) though I stick with .html.

Tim

Re: Please help with the .htaccess YIKES!

Posted: Fri Apr 27, 2007 1:17 pm
by soulja90
Now it shows the redirect work - BUT

it shows the URL like this:

http://www.wdclub.com/?page=american-dropshipper

Like you can see the page - it redirects fine

but the url is

http://www.wdclub.com/?page=american-dropshipper

the URL must be
http://www.wdclub.com/articles/dropship ... opshipper/

PS: I had to remove that .htaccess file because a lot of other pages weren't working.

?page=

should be replaced with

articles/dropshipper-reviews/international-dropshippers/

Please help - Thanks for all your efforts

Re: Please help with the .htaccess YIKES!

Posted: Fri Apr 27, 2007 1:31 pm
by moorezilla
Be aware the newer versions of Apache don't seem to like:

RewriteCond %{REQUEST_FILENAME} !-f [NC]
RewriteCond %{REQUEST_FILENAME} !-d [NC]

and will start to fill up the apache error.log with no case errors.

I got rid of the [NC] on both lines and everything seems to work fine.

Re: Please help with the .htaccess YIKES!

Posted: Fri Apr 27, 2007 2:26 pm
by soulja90

Re: Please help with the .htaccess YIKES!

Posted: Fri Apr 27, 2007 3:18 pm
by Pierre M.
http://www.wdclub.com/american-dropshipper adds a trailing slash and th new request gives a strange formatted page.

May be you should try to install from scratch with sample content in another folder, say /testCMSms. Another folder, another db prefix, another .htaccess in /testCMSms. Don't try to mix with your existing things. First make a standard install work, then customize it.

Pierre M.

Re: Please help with the .htaccess YIKES!

Posted: Sat Apr 28, 2007 1:29 am
by soulja90
thanks pierre - thats not an option tho -  i know theres an answer to this - thanks for your input - still need help cuz i gosta redirect