Invision Community 4: SEO, prepare for v5 and dormant account notifications Matt November 11, 2024Nov 11
Posted November 26, 20213 yr Hello. I have problems with index.php in my urls. I have the htaccess file and select "Rewrite URLs". The problem is: URL in browser -> Destinationmydomain.com/index.php -> mydomain.com/index.php mydomain.com/index.php/ -> mydomain.com mydomain.com/forum/topic/index.php -> mydomain.com/ mydomain.com/forum/topic/ -> mydomain.com/forum/topic/ Please, can someone check my text to see if there is something wrong? <IfModule mod_rewrite.c> Options -MultiViews RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteRule \.(js|css|jpeg|jpg|gif|png|ico|map)(\?|$) /404error.php [L,NC] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> #Force HTTPS RewriteCond %{HTTPS} !=on RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] RedirectMatch ^/forum/(.*?)/?$ /$1 # CUSTOM URLs by DawPi #Categories & Forums RewriteRule ^([0-9]+)-([a-zA-Z0-9_-]+).html$ viewforum.php?id=$1 [r=301,nc,l] RewriteRule ^forum/([0-9]+)-([a-zA-Z0-9_-]+).html$ viewforum.php?id=$1 [r=301,nc,l] #Profiles RewriteRule join-club/([0-9]+)-([a-zA-Z0-9_-]+)/profile.html profile.php?id=$1 [r=301,nc,l] #Topics (second and so on page) RewriteRule ([0-9]+)-([a-zA-Z0-9_-]+)/([0-9]+)-([a-zA-Z0-9_-]+).html?start=([0-9]+) viewtopic.php?id=$3&st=$5 [r=301,nc,l] #Topics RewriteRule ([0-9]+)-([a-zA-Z0-9_-]+)/([0-9]+)-([a-zA-Z0-9_-]+).html viewtopic.php?id=$3 [r=301,nc,l] # END # # ---------------------------------------------------------------------- # | ADDED BY ME | # ---------------------------------------------------------------------- <Files .htaccess> Require all denied </Files> #Allow conections only bu mydomain.com and alias RewriteCond %{SERVER_NAME} !^(www\.)?mydomain\.es$ RewriteCond %{SERVER_NAME} !^(www\.)?mydomain2\.com$ RewriteCond %{SERVER_NAME} !^(www\.)?mydomain\.eu$ RewriteCond %{SERVER_NAME} !^(www\.)?mydomain\.info$ RewriteCond %{SERVER_NAME} !^(www\.)?mydomain\.com.es$ RewriteCond %{SERVER_NAME} !^(www\.)?mydomain\.es$ RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$ RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$ RewriteRule ^ - [F] RewriteCond %{HTTP_HOST} ^www.mydomain2.com [NC] RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$ RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$ RewriteRule ^(.*)$ https://www.mydomain.es/$1 [L,R=301] RewriteCond %{HTTP_HOST} ^mydomain2.com [NC] RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$ RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$ RewriteRule ^(.*)$ https://www.mydomain.es/$1 [L,R=301] RewriteCond %{HTTP_HOST} ^www.mydomain.eu [NC] RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$ RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$ RewriteRule ^(.*)$ https://www.mydomain.es/$1 [L,R=301] RewriteCond %{HTTP_HOST} ^mydomain.eu [NC] RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$ RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$ RewriteRule ^(.*)$ https://www.mydomain.es/$1 [L,R=301] RewriteCond %{HTTP_HOST} ^www.mydomain.info [NC] RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$ RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$ RewriteRule ^(.*)$ https://www.mydomain.es/$1 [L,R=301] RewriteCond %{HTTP_HOST} ^mydomain.info [NC] RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$ RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$ RewriteRule ^(.*)$ https://www.mydomain.es/$1 [L,R=301] RewriteCond %{HTTP_HOST} ^www.mydomain.com.es [NC] RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$ RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$ RewriteRule ^(.*)$ https://www.mydomain.es/$1 [L,R=301] RewriteCond %{HTTP_HOST} ^mydomain.com.es [NC] RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$ RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$ RewriteRule ^(.*)$ https://www.mydomain.es/$1 [L,R=301] #Clickjacking attack #Header append X-FRAME-OPTIONS "SAMEORIGIN" RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$ RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$ RewriteCond %{HTTP_REFERER} !^$ RewriteCond %{HTTP_REFERER} !^http://mydomain.es/.*$ [NC] RewriteCond %{HTTP_REFERER} !^http://mydomain.es$ [NC] RewriteCond %{HTTP_REFERER} !^http://mydomain2.com/.*$ [NC] RewriteCond %{HTTP_REFERER} !^http://mydomain2.com$ [NC] RewriteCond %{HTTP_REFERER} !^http://www.mydomain.es/.*$ [NC] RewriteCond %{HTTP_REFERER} !^http://www.mydomain.es$ [NC] RewriteCond %{HTTP_REFERER} !^http://www.mydomain2.com/.*$ [NC] RewriteCond %{HTTP_REFERER} !^http://www.mydomain2.com$ [NC] RewriteCond %{HTTP_REFERER} !^https://mydomain.es/.*$ [NC] RewriteCond %{HTTP_REFERER} !^https://mydomain.es$ [NC] RewriteCond %{HTTP_REFERER} !^https://www.mydomain.es/.*$ [NC] RewriteCond %{HTTP_REFERER} !^https://www.mydomain.es$ [NC] RewriteRule .*\.(jpg|jpeg|gif|png|bmp|doc|pdf|mp3|mp4|mov|avi)$ - [F,NC] # php -- BEGIN cPanel-generated handler, do not edit <IfModule mime_module> AddHandler application/x-httpd-ea-php74 .php .php7 .phtml </IfModule> # php -- END cPanel-generated handler, do not edit Many Thanks. Edited November 27, 20213 yr by pequeno
November 27, 20213 yr Author If I just put this code, it doesn't work either <IfModule mod_rewrite.c> Options -MultiViews RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteRule \.(js|css|jpeg|jpg|gif|png|ico|map)(\?|$) /404error.php [L,NC] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule>
December 1, 20213 yr 14 hours ago, pequeno said: Any help about this? I have tagged developers on this to take a look at your topic and review.
December 9, 20213 yr Author On 12/1/2021 at 8:37 AM, Marc Stridgen said: I have tagged developers on this to take a look at your topic and review. Any news about this
December 10, 20213 yr Relooking at this, what exactly is the first one doing? The topic one would not work, as thats not actually a URL even without rewrites.
December 10, 20213 yr Author 45 minutes ago, Marc Stridgen said: Relooking at this, what exactly is the first one doing? The topic one would not work, as thats not actually a URL even without rewrites. I will privately send you the URL that corresponds to mydomain.com I put it this way so as not to reveal my domain.
December 10, 20213 yr You dont seem to have answered what the first one is doing there. The second, there isnt actually an issue with.
December 10, 20213 yr Author Sorry. I don't know what I have to answer. I am a bit lost with the English language. What do you need to know exactly? Redirects should remove index.php and I see that not happening.
December 10, 20213 yr <IfModule mod_rewrite.c> Options -MultiViews RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteRule \.(js|css|jpeg|jpg|gif|png|ico|map)(\?|$) /404error.php [L,NC] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> Try and put this at the bottom of your htaccess file
December 12, 20213 yr Author On 12/10/2021 at 9:42 PM, Adlago said: <IfModule mod_rewrite.c> Options -MultiViews RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteRule \.(js|css|jpeg|jpg|gif|png|ico|map)(\?|$) /404error.php [L,NC] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> Try and put this at the bottom of your htaccess file Thanks. It's the code I use, provided by IPS in the ACP, and it doesn't work ... I can't remove index.php from the url
December 12, 20213 yr 3 hours ago, pequeno said: Thanks. It's the code I use, provided by IPS in the ACP, and it doesn't work ... I can't remove index.php from the url If your site is in forum directory, put in this directory htaccess file with this code
December 12, 20213 yr The only way that htaccess code will work is if your hosting provider has mod_rewrite enabled. Have you verified that module is installed and working correctly?
December 12, 20213 yr Author 6 hours ago, Adlago said: If your site is in forum directory, put in this directory htaccess file with this code Forum is in root / 14 minutes ago, Randy Calvert said: The only way that htaccess code will work is if your hosting provider has mod_rewrite enabled. Have you verified that module is installed and working correctly? Installed and enabled.
December 12, 20213 yr This post was recognized by Marc! Adlago was awarded the badge 'Helpful' and 10 points. "Thank you for your help" 32 minutes ago, pequeno said: Forum is in root / Installed and enabled. Test - add this RewriteCond %{THE_REQUEST} \ /(.+/)?index\.([^/]+)(\?.*)?\ [NC] RewriteRule ^(.+/)?index\.([^/]+)$ /%1 [NC,R=301,L]
December 13, 20213 yr Again, you havent actually answered what is happening on the first item when you visit with /index.php It does sound here like there may be an issue with rewrites on your server
December 13, 20213 yr Author 1 hour ago, Marc Stridgen said: Again, you havent actually answered what is happening on the first item when you visit with /index.php It does sound here like there may be an issue with rewrites on your server Indeed, if I put the address with index.php in the browser, it is not removed and the destination is the same. On 11/26/2021 at 10:19 PM, pequeno said: URL in browser -> Destinationmydomain.com/index.php -> mydomain.com/index.php The redirect to remove index.php does not apply in my case. It only applies if I put a / at the end. On 11/26/2021 at 10:19 PM, pequeno said: mydomain.com/index.php/ -> mydomain.com The same happens in topics that have index.php at the end. On 11/26/2021 at 10:19 PM, pequeno said: mydomain.com/forum/topic/index.php -> mydomain.com/ mydomain.com/forum/topic/ -> mydomain.com/forum/topic/ Thanks @Adlago 13 hours ago, Adlago said: Test - add this RewriteCond %{THE_REQUEST} \ /(.+/)?index\.([^/]+)(\?.*)?\ [NC] RewriteRule ^(.+/)?index\.([^/]+)$ /%1 [NC,R=301,L] I will test.
December 13, 20213 yr Author 22 hours ago, Adlago said: Test - add this RewriteCond %{THE_REQUEST} \ /(.+/)?index\.([^/]+)(\?.*)?\ [NC] RewriteRule ^(.+/)?index\.([^/]+)$ /%1 [NC,R=301,L] Works Perfectly! Thanks.
December 15, 20213 yr Author On 12/13/2021 at 9:53 PM, pequeno said: Works Perfectly! Thanks. On 12/13/2021 at 12:58 PM, Marc Stridgen said: Please let us know if that does not resolve your issue On 12/12/2021 at 11:03 PM, Adlago said: Test - add this RewriteCond %{THE_REQUEST} \ /(.+/)?index\.([^/]+)(\?.*)?\ [NC] RewriteRule ^(.+/)?index\.([^/]+)$ /%1 [NC,R=301,L] NOT SOLVED! Works removing index.php but when I try to upload a embed video or image, I obtain this error: Quote The link could not be embedded because of an unexpected error: forbidden. The CSRF protection key did not match. This may indicate a plugin or theme is out of date. Please contact technical support for more information.
December 15, 20213 yr Please ensure all access details on file are up to date, then we can take a look. Also please ensure you are using only our default htaccess
December 15, 20213 yr Author 2 hours ago, Marc Stridgen said: Please ensure all access details on file are up to date, then we can take a look. Also please ensure you are using only our default htaccess Thanks @Marc Stridgen Please, let me know the IPS IPs for add to firewall whitelist.
December 15, 20213 yr 1 hour ago, pequeno said: Thanks @Marc Stridgen Please, let me know the IPS IPs for add to firewall whitelist. please add 50.28.58.142 and 144.202.11.32 to your firewall whitelist.
December 15, 20213 yr Author 55 minutes ago, Jim M said: please add 50.28.58.142 and 144.202.11.32 to your firewall whitelist. Done
December 20, 20213 yr Author On 12/15/2021 at 7:07 PM, Marc Stridgen said: Please ensure all access details on file are up to date, then we can take a look. Also please ensure you are using only our default htaccess Have you checked It? I need to restore my custom htaccess. Thanks.