Skip to main content

Comments

9 comments

  • LostNerd
    1. In cPanel, make sure your redirect is set up as a "Wild Card Redirect" if you want to redirect the domain but also the filename. 2. Code issues/requests are better on a site such as StackOverflow.
    0
  • 123bear
    . In cPanel, make sure your redirect is set up as a "Wild Card Redirect" if you want to redirect the domain but also the filename. 2. Code issues/requests are better on a site such as StackOverflow.

    I can NOT use Wild Card Redirect; because I get 'endless redirecting': "the server proccess this request in a way it will never be completed", or something similar. Do you need the .htaccess file?
    0
  • cPanelMichael
    Hello, Do you already have custom Mod_Rewrite rules associated with a script in your .htaccess file? Have you tried setting up individual redirects for specific file names? Thank you.
    0
  • 123bear
    Hello, Do you already have custom Mod_Rewrite rules associated with a script in your .htaccess file? Have you tried setting up individual redirects for specific file names? Thank you.

    "custom Mod_Rewrite rules associated with a script in your .htaccess file?" Please elaborate... individual redirects for specific file names is too much trouble. Main .htaccess, before public_html SetOutputFilter DEFLATE # Netscape 4.x has some problems... BrowserMatch ^Mozilla/4 gzip-only-text/html # Netscape 4.06-4.08 have some more problems BrowserMatch ^Mozilla/4\.0[678] no-gzip # MSIE masquerades as Netscape, but it is fine # BrowserMatch \bMSIE !no-gzip !gzip-only-text/html # NOTE: Due to a bug in mod_setenvif up to Apache 2.0.48 # the above regex won't work. You can use the following # workaround to get the desired effect: BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html # Don't compress images SetEnvIfNoCase Request_URI .(?:gif|jpe?g|png)$ no-gzip dont-vary # Make sure proxies don't deliver the wrong content Header append Vary User-Agent env=!dont-vary RewriteEngine On RewriteCond %{HTTP_HOST} ^(www.)?domain.com$ [NC] RewriteCond %{REQUEST_URI} ^/directory/(.*)$ RewriteRule ^(.*)$ - [L,R=404] # 1 YEAR ExpiresActive On Header set Cache-Control "max-age=29030400, public" ExpiresDefault "access plus 1 years" Header unset Last-Modified Header unset ETag SetOutputFilter DEFLATE # 1 MONTHS Header set Cache-Control "max-age=2629000, public" ExpiresDefault "access plus 1 month" SetOutputFilter DEFLATE Header set Cache-Control "max-age=2629000, public" ExpiresDefault "access plus 1 week" SetOutputFilter DEFLATE ### .htaccess Inside public_html RewriteEngine on # compress text, html, javascript, css, xml: AddOutputFilterByType DEFLATE text/plain AddOutputFilterByType DEFLATE text/html AddOutputFilterByType DEFLATE text/xml AddOutputFilterByType DEFLATE text/css AddOutputFilterByType DEFLATE application/xml AddOutputFilterByType DEFLATE application/xhtml+xml AddOutputFilterByType DEFLATE application/rss+xml AddOutputFilterByType DEFLATE application/javascript AddOutputFilterByType DEFLATE application/x-javascript RewriteEngine On RewriteCond %{REQUEST_URI} ^/directory/(.*)$ RewriteCond %{HTTP_REFERER} !^ [NC] RewriteCond %{HTTP_REFERER} !^ [NC] RewriteCond %{HTTP_REFERER} !^ [NC] RewriteCond %{HTTP_REFERER} !^ [NC] RewriteCond %{HTTP_REFERER} !^ [NC] RewriteRule .*\.(jpg|jpeg|gif|png|bmp|css)$ - [F,NC] # 1 YEAR ExpiresActive On Header set Cache-Control "max-age=29030400, public" ExpiresDefault "access plus 1 years" Header unset Last-Modified Header unset ETag SetOutputFilter DEFLATE # 1 MONTHS Header set Cache-Control "max-age=2629000, public" ExpiresDefault "access plus 1 month" SetOutputFilter DEFLATE Header set Cache-Control "max-age=2629000, public" ExpiresDefault "access plus 1 week" SetOutputFilter DEFLATE RewriteCond %{HTTP_HOST} ^www\.domain\.com$ RewriteRule ^/?$ "http\:\/\/domain\.com\/" [R=301,L] What is wrong?
    0
  • cPanelMichael
    Hello, Please keep in mind that custom redirect rules are not supported. We're happy to help as much as possible, but we can't write custom Mod_Rewrite rules for you. Have you tried backing up the existing rules, and adding the new rules to see if that's where the issue is? This third-party URL might help regarding new rules:
    0
  • 123bear
    Hello, Please keep in mind that custom redirect rules are not supported. We're happy to help as much as possible, but we can't write custom Mod_Rewrite rules for you. Have you tried backing up the existing rules, and adding the new rules to see if that's where the issue is? This third-party URL might help regarding new rules:
    0
  • cPanelMichael
    I remember it used to work flawlessly. Would it help if I'll delete the .htaccess that inside the public_html directory? (or vice versa?)

    You can try renaming the .htaccess file instead of deleting it so that it's disabled and backed up at the same time. Then, add the custom rules to a new .htaccess file. Thank you.
    0
  • 123bear
    You can try renaming the .htaccess file instead of deleting it so that it's disabled and backed up at the same time. Then, add the custom rules to a new .htaccess file. Thank you.

    It works well now: probably a collisions between the two files. Immediately upon renaming original .htaccess; cPanel AUTOMATICALLY creates a new file with 100% correct settings.
    0
  • cPanelMichael
    I am happy to see that resolved the issue. You could try manually inserting the custom rules one at a time if you want to see which particular one is at fault. Thank you.
    0

Please sign in to leave a comment.