Invision Community 4: SEO, prepare for v5 and dormant account notifications By Matt Monday at 02:04 PM
pequeno Posted November 26, 2021 Posted November 26, 2021 (edited) 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, 2021 by pequeno
pequeno Posted November 27, 2021 Author Posted November 27, 2021 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>
Marc Posted December 1, 2021 Posted December 1, 2021 14 hours ago, pequeno said: Any help about this? I have tagged developers on this to take a look at your topic and review. pequeno 1
pequeno Posted December 9, 2021 Author Posted December 9, 2021 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
Marc Posted December 10, 2021 Posted December 10, 2021 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. pequeno 1
pequeno Posted December 10, 2021 Author Posted December 10, 2021 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.
Marc Posted December 10, 2021 Posted December 10, 2021 You dont seem to have answered what the first one is doing there. The second, there isnt actually an issue with. pequeno 1
pequeno Posted December 10, 2021 Author Posted December 10, 2021 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.
Adlago Posted December 10, 2021 Posted December 10, 2021 <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 pequeno 1
pequeno Posted December 12, 2021 Author Posted December 12, 2021 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
Adlago Posted December 12, 2021 Posted December 12, 2021 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 pequeno 1
Randy Calvert Posted December 12, 2021 Posted December 12, 2021 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? pequeno 1
pequeno Posted December 12, 2021 Author Posted December 12, 2021 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.
Adlago Posted December 12, 2021 Posted December 12, 2021 This post was recognized by Marc! "Thank you for your help" Adlago was awarded the badge 'Helpful' and 10 points. 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] pequeno 1
Marc Posted December 13, 2021 Posted December 13, 2021 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
pequeno Posted December 13, 2021 Author Posted December 13, 2021 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.
Marc Posted December 13, 2021 Posted December 13, 2021 Please let us know if that does not resolve your issue
pequeno Posted December 13, 2021 Author Posted December 13, 2021 22 hours ago, Adlago said: Test - add this RewriteCond %{THE_REQUEST} \ /(.+/)?index\.([^/]+)(\?.*)?\ [NC] RewriteRule ^(.+/)?index\.([^/]+)$ /%1 [NC,R=301,L] Works Perfectly! Thanks. Adlago 1
pequeno Posted December 15, 2021 Author Posted December 15, 2021 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.
Marc Posted December 15, 2021 Posted December 15, 2021 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 pequeno 1
pequeno Posted December 15, 2021 Author Posted December 15, 2021 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.
Jim M Posted December 15, 2021 Posted December 15, 2021 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.
pequeno Posted December 15, 2021 Author Posted December 15, 2021 55 minutes ago, Jim M said: please add 50.28.58.142 and 144.202.11.32 to your firewall whitelist. Done
pequeno Posted December 20, 2021 Author Posted December 20, 2021 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.
Recommended Posts