Please help with the .htaccess YIKES!

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
soulja90
Forum Members
Forum Members
Posts: 83
Joined: Tue Mar 13, 2007 10:56 pm

Please help with the .htaccess YIKES!

Post 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
skypanther

Re: Please help with the .htaccess YIKES!

Post 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
soulja90
Forum Members
Forum Members
Posts: 83
Joined: Tue Mar 13, 2007 10:56 pm

Re: Please help with the .htaccess YIKES!

Post 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
Last edited by soulja90 on Fri Apr 27, 2007 1:21 pm, edited 1 time in total.
moorezilla

Re: Please help with the .htaccess YIKES!

Post 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.
soulja90
Forum Members
Forum Members
Posts: 83
Joined: Tue Mar 13, 2007 10:56 pm

Re: Please help with the .htaccess YIKES!

Post by soulja90 »

Pierre M.

Re: Please help with the .htaccess YIKES!

Post 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.
soulja90
Forum Members
Forum Members
Posts: 83
Joined: Tue Mar 13, 2007 10:56 pm

Re: Please help with the .htaccess YIKES!

Post 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
Post Reply

Return to “CMSMS Core”