Welcome Guest, Not a member yet? Register   Sign In
.htaccess segment name change?
#1

[eluser]SitesByJoe[/eluser]
Ok, here goes.

Like an idiot I named a couple functions on my controllers "view" which has come back to haunt me since its a reserved word.

Google indexed all the pages that use the "view" function which I have renamed to "detail"...

I need to add a line to my .htaccess file that either rewrites "view" as "detail" or does a 301 to the same url, but with "detail" in place of "view".

Changing this url:
http://capemaycountycontractors.com/cate...iew/siding

To:
http://capemaycountycontractors.com/cate...ail/siding

My existing .htaccess file looks like:

Code:
AddType application/x-httpd-php .php .htm .asp .xml .rss

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>

Could anyone please give me some advice on this?
#2

[eluser]exodus7[/eluser]
I'm no expert in mod_rewrite, but try the following:

Code:
AddType application/x-httpd-php .php .htm .asp .xml .rss

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /

Redirect 301 /categories/view/siding http://capemaycountycontractors.com/categories/detail/siding

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

[eluser]Sean Murphy[/eluser]
This should get you fixed up:
Code:
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^(.*)/view/(.*)$ $1/detail/$2 [L,R=301]
    
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
#4

[eluser]SitesByJoe[/eluser]
Sean,

Your changes work (I see the url change) but then I get a "no input" error. Any idea why?
#5

[eluser]Sean Murphy[/eluser]
I'm not sure why my change would cause that, but I suggest reading over this thread for clues: http://ellislab.com/forums/viewthread/55620/
#6

[eluser]SitesByJoe[/eluser]
That link did it. My site is on dreamhost and applying the "?" fixed everything nicely!

Thanks!




Theme © iAndrew 2016 - Forum software by © MyBB