Invision Community 4: SEO, prepare for v5 and dormant account notifications By Matt Monday at 02:04 PM
therealstn Posted April 27, 2015 Posted April 27, 2015 Friendly Urls do not seem to be working properly, in all cases. For example it works fine and redirects to the correct topic when i use theseexample.com/topic/7427-topicname/example.com/index.php?/topic/7427-topicname/BUT when trying to access this way, it just goes back to homepage and doesn't redirect to the topic.example.com/index.php/topic/7427-topicname/^Notice there is no ? in index.php, if you add a ? then it redirects fineThis is very important for me because all the urls are indexed without the ? (example.com/index.php/topic/7427-topicname/) in Google index and when you access the site through google index, it redirects to the homepage instead of the topic so i will end up losing rank for all the topics!!. Tried to modify htaccess script (that IPS4 provides) to fix this and i was able to make it add the ? after index.php and it worked fine but that also made images and every other script urls to be re-written as well with a ? appended lol....i don't understand mod_rewrite enough to fix this myself.Can anyone let me know if this is due to some mod i am missing on my server (its Hostgator server) or if its supposed to act this way then can someone write a quick script so it works without the ? as well ?.Thanks
opentype Posted April 27, 2015 Posted April 27, 2015 I think this is working as intended. It seems you are trying to put the cart before the horse. You shouldn’t try to keep wrong URLs working, but instead let the friendly URLs do their job. Google isn’t supposed to index those URLs with or without the ?, it is supposed to use the friendly URLs only. If you have changed the friendly URL settings recently, that might take a while.
therealstn Posted April 27, 2015 Author Posted April 27, 2015 I think this is working as intended. It seems you are trying to put the cart before the horse. You shouldn’t try to keep wrong URLs working, but instead let the friendly URLs do their job. Google isn’t supposed to index those URLs with or without the ?, it is supposed to use the friendly URLs only. If you have changed the friendly URL settings recently, that might take a while. Well, the problem now is if those 'wrong urls' don't work (especially the urls without the ?) and only the friendly urls work then google will remove it from the index AND treat the friendly urls as new content!. Notice the problem ? There are a lot of links pointing to my site content this way (/index.php/topic/) and i can't lose those links or making them into 404s...you can guess how catastrophic it will be for rankings.There must be a way to do it with htaccess, i was able to make it work except images/js got messed up because of the appended ?. If the images/js/scripts can be spared (they don't get a ? appended to their urls) then it should work fine, i simply don't have the knowledge, unfortunately. PS: I upgraded to IPS4 recently and the urls work differently by default hence my problem. I wouldn't care for friendly urls if the old urls worked fine which they don't :-(. EDIT: This is the mod_rewrite script that i wrote that changed the urls from index.php/topic/ to index.php?/topic/RewriteCond %{HTTP_HOST} ^www\.mysite\.com$ [OR]RewriteCond %{HTTP_HOST} ^mysite\.com$ RewriteRule ^([a-zA-Z0-9\-]+)/(.*)$ "http\:\/\/mysite\.com\/$1\?$2$3" [R=301,L]
therealstn Posted April 27, 2015 Author Posted April 27, 2015 nvm fixed it myself! In case anyone else is having same problem and want to know how i did, here is my full htaccess mod rewrite code. Instead of adding ?, this now redirects from index.php/topic to /topic/ which is the correct friendly url and also uses the 301 redirect so Google will refresh their index to the new URLs. RewriteEngine onRewriteCond %{HTTP_HOST} ^www\.deviatedhacking\.com$ [OR]RewriteCond %{HTTP_HOST} ^deviatedhacking\.com$ RewriteRule ^([*index\.php]+)/(+)/(.*)$ "http\:\/\/deviatedhacking\.com\/$2\/$3" [R=301,L] <IfModule mod_rewrite.c>Options -MultiViewsRewriteEngine OnRewriteBase /RewriteCond %{REQUEST_FILENAME} !-fRewriteRule \.(jpeg|jpg|gif|png)$ /public/404.php [NC,L] RewriteCond %{REQUEST_FILENAME} !-fRewriteCond %{REQUEST_FILENAME} !-dRewriteRule . /index.php [L]</IfModule> PS: Only applies to topics, won't touch users/images or any other script at all. Oh and please close this thread as the issue is resolved.
2dub Posted May 1, 2015 Posted May 1, 2015 I seem to be having a similar problem. However, my issue is that since the upgrade a "?" has been inserted into my url's. Is this something I can fix through htaccess? Examples:Former url before upgrade sends to homepage: http://umpire-empire.com/index.php/topic/53862-mask-it-sports-powder-coating/New url after upgrade with "?": http://umpire-empire.com/index.php?/topic/53862-mask-it-sports-powder-coating/My concern is that Google search links are indexed the old way and I may loose traffic. Below is my current htaccess, what would I do to correct?Options All -Indexes Options +FollowSymLinks RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*) index.phpI would appreciate the help. Thanks.
Ilya Hoilik Posted May 1, 2015 Posted May 1, 2015 Just add this lineRedirectMatch /index.php/(.*)$ /index.php?/$1
Recommended Posts
Archived
This topic is now archived and is closed to further replies.