homepage Welcome to WebmasterWorld Guest from 23.21.9.44
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

    
Redirect posts,tags but not categories ?!?
problem with redirect on Godaddy hosting !
eyefox




msg:4440308
 2:24 am on Apr 13, 2012 (gmt 0)

Hi

I'm using Godaddy Linux Hosting for my wallpaper site

I got script from W-Script, this is a awesome script, but when I enable mod_rewrite, it just work 99%.

here is my .htaccess
DirectoryIndex index.php
Options +FollowSymLinks

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*) index.php?/$1 [L]
RewriteRule ^$ /index.php [L]
RewriteCond $1 !^(index\.php|install|img|images|scripts|fonts|uploads|css|js|robots\.txt|sitemap\.xml|favicon\.ico)
RewriteRule (.*)-(.*)\.html$ wallpapers/show/$2
RewriteRule (.*)-(.*)/$ categories/show/$2


This .htaccess work well on my posts,tags

But with Categories it didn't work.The browser gave me long response and error message !


I follow the article on W-script about Godaddy hosting but it also don't work either
[w-script.com ]

So, I need help to solve this problem !

Thank you for advanced
Hieu

[edited by: incrediBILL at 5:29 am (utc) on Apr 13, 2012]
[edit reason] personal URLs removed, use example.com only [/edit]

 

bunltd




msg:4440314
 2:40 am on Apr 13, 2012 (gmt 0)

Did you also edit the config.php file as mentioned in the W-script docs you linked to?

eyefox




msg:4440317
 2:46 am on Apr 13, 2012 (gmt 0)

@bunltd : thank you for reply, I already edit this file, but it didn't work also.

eyefox




msg:4440512
 3:00 pm on Apr 13, 2012 (gmt 0)

anyone can help me ?

bunltd




msg:4440537
 3:47 pm on Apr 13, 2012 (gmt 0)

Have you checked your log files for errors?

lucy24




msg:4440720
 2:20 am on Apr 14, 2012 (gmt 0)

here is my .htaccess
DirectoryIndex index.php
Options +FollowSymLinks

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*) index.php?/$1 [L]
RewriteRule ^$ /index.php [L]
RewriteCond $1 !^(index\.php|install|img|images|scripts|fonts|uploads|css|js|robots\.txt|sitemap\.xml|favicon\.ico)
RewriteRule (.*)-(.*)\.html$ wallpapers/show/$2
RewriteRule (.*)-(.*)/$ categories/show/$2


... and that's why people will always tell you to leave a blank line after each Rule, and to annotate each one. It's important to see where each Condition-plus-Rule package ends and the next one begins-- and to know what each one is intended to do. Here you have four Rules.

# Rule 1
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*) index.php?/$1 [L]

"If the request is for any nonexistent file, serve content from the index.php file, using the requested filename as parameter." Since the Rule doesn't exclude images, css, javascript etc, this package will slow your server to a crawl.

# Rule 2
RewriteRule ^$ /index.php [L]

"If there is a null request, serve content from index.php". This rule is simply unnecessary, because mod_dir will do the same thing. That's its job.

# Rule 3
RewriteCond $1 !^(index\.php|install|img|images|scripts|fonts|uploads|css|js|robots\.txt|sitemap\.xml|favicon\.ico)
RewriteRule (.*)-(.*)\.html$ wallpapers/show/$2

Oh, lordy, this one looks familiar ;) "If the request contains one or more hyphens and ends in .html, then if the part before the hyphen does not begin with {long string of stuff} then serve content from 'wallpapers/show/{stuff, if any, after the final hyphen} and continue to the next Rule."

# Rule 4
RewriteRule (.*)-(.*)/$ categories/show/$2
"Same as above, without conditions, because this version applies only to requests for directories. Again, continue to the next Rule, if there is one."

99% working? I'm impressed. I would have guessed 67%. The most glaring problem is the lack of [L] flags after rules 3 and 4, but there are undoubtedly others.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved