Register Advertise with usHelp Desk Today's Posts Search

Closed Thread
Thread Tools Search this Thread
Unread 14th Jul 2013, 07:01 AM   #1
HyperActive Warrior
Registered Member
War Room Member
 
Join Date: 2007
Location: , , .
Posts: 322
Thanks: 167
Thanked 31 Times in 30 Posts
Post
I need help to redirect these links to 404 error
Share on: 
fb share twitter share gplus share more share

If someone tries to access these abbreviated page-types, then a 404 error:

http://getcityweather.com/international/region/na.html
http://getcityweather.com/internatio...forecasts.html
http://getcityweather.com/internatio...forecasts.html
http://getcityweather.com/internatio...forecasts.html

I had tried to use .htaccess file redirect

[code]
# redirect all non-www traffic
#RewriteCond %{HTTP_HOST} ^region/\?\?\.html$
#RewriteRule ^region/??\.html$ http://www.google.com [R=permanent,L]
#RewriteRule ^region/([A-Za-z]{2})\.html$ http://www.google.com [R=permanent,L]

or this below code

Redirect 301 /region/af.html http://www.getcityweather.com/us/

[\code]

Some one please let me know, whether I should do it through .htaccess way
or is there anything in php like catching the url and redirecting them.

Please help it is little urgent.
alfa_375 is offline  
Unread 14th Jul 2013, 09:53 AM   #2
I am developer I think so
 
Join Date: 2013
Location: Ahemdabad
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default
Re: I need help to redirect these links to 404 error
Share on: 
fb share twitter share gplus share more share

server {
listen 80;
server_name _;
root /var/www/vhosts/$host/httpdocs/;
error_page 404 /;
location / {
try_files $uri $uri/ /index.php;
}
location ~ \.php$ {
try_files $uri =404;
include fastcgi_params;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_script_name;
#fastcgi_pass php;
fastcgi_pass 127.0.0.1:9000;
}
location ~* \.(?:ico|css|js|gif|jpe?g|png)$ {
expires max;
add_header Pragma public;
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
}
# this prevents hidden files (beginning with a period) from being served
location ~ /\. { access_log off; log_not_found off; deny all; }
}
jasontrailor is offline  
Unread 14th Jul 2013, 12:14 PM   #3
HyperActive Warrior
Registered Member
War Room Member
 
Join Date: 2007
Location: , , .
Posts: 322
Thanks: 167
Thanked 31 Times in 30 Posts
Default
Re: I need help to redirect these links to 404 error
Share on: 
fb share twitter share gplus share more share

lol! is this is a php script or httaccess file? sorry bro, would you please put some light on it.

Little description will be appreciated. I am looking for some html links not the php ones.

Any how thanks a lot for stop by and put that great code here.
alfa_375 is offline  
Unread 16th Jul 2013, 07:48 PM   #4
HyperActive Warrior
Registered Member
War Room Member
 
Join Date: 2007
Location: , , .
Posts: 322
Thanks: 167
Thanked 31 Times in 30 Posts
Default
Re: I need help to redirect these links to 404 error
Share on: 
fb share twitter share gplus share more share

Thanks guys for your response, I had sort out this thing by Mr. google.

Oh here is my code for this file, which is working like a charm.

Code:
RewriteEngine On
 
RewriteRule (^region/[A-Za-z]{2}.html) - [F,L] ###/asdf [R,L]

Once again thanks warriors for your time for providing such valuable help. I want to set best answer but I don't want to others to discourage for their efforts.

alfa_375 is offline  
Unread 16th Jul 2013, 10:28 PM   #5
Graphics, PHP, .Net, Html
War Room Member
 
WebdevelopmentGroup's Avatar
 
Join Date: 2011
Location: New York, NY
Posts: 2,176
Thanks: 199
Thanked 170 Times in 132 Posts
Default
Re: I need help to redirect these links to 404 error
Share on: 
fb share twitter share gplus share more share

I'm sending you a PM now.

Theres something wrong with the .html file you have set up.

WILL -

WebDevelopmentGroup NYC & CA- Small Business Web Development, App Development, WordPress Development, Graphic Designs, Online Marketing, Local Marketing & more!. "Call us 1.800.219.1314 or message us!". Visit us today! "Now On Live Chat Mon-Fri.". www.WebDevelopmentGroup.org
(Whitelable our Services)
===================================
==> #1 OFFLINE MARKETING FORUM ON THE WEB! <==
www.OFFLINEMARKETINGFORUM.com
(Register Now)
WebdevelopmentGroup is offline  
Closed Thread


Bookmarks

Tags
404, error, links, redirect


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




All times are GMT -6. The time now is 10:18 PM.