I need help to redirect these links to 404 error

4 replies
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.
#404 #error #links #redirect
  • Profile picture of the author jasontrailor
    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; }
    }
    {{ DiscussionBoard.errors[8278655].message }}
  • Profile picture of the author alfa_375
    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.
    {{ DiscussionBoard.errors[8279000].message }}
  • Profile picture of the author alfa_375
    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.
    {{ DiscussionBoard.errors[8288188].message }}
  • I'm sending you a PM now.

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

    WILL -
    Signature
    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)
    {{ DiscussionBoard.errors[8288581].message }}

Trending Topics