adam291086 Posted January 9, 2008 Share Posted January 9, 2008 i read this on the internet Avoid dynamic URLs, use .htaccess to rewrite them. Search engines may not index all of your pages if you are using dynamic URLs such as www.domain.com/index.php?page=news, this is because the spider sees just one page - index.php. To avoid this problem you can use .htaccess to re-write your URLs to a more search engine friendly (and user friendly) URLs. Htaccess is a completely different area to SEO so if you want to learn about rewriting URLs with .htaccess, you can read about it in this .htaccess tutorial. As an example, in the scenario above we want to convert the URL from www.domain.com/index.php?page=news to www.domain.com/news/, this is simple with .htaccess, just two lines of code - RewriteEngine On RewriteRule ^(.+)/ index.php?page=$1 Is there anyother ways around it other than what is mentioned above? Quote Link to comment https://forums.phpfreaks.com/topic/85184-dynamic-urls/ Share on other sites More sharing options...
trq Posted January 9, 2008 Share Posted January 9, 2008 Is there anyother ways around it other than what is mentioned above? Whats wrong with the method above? Quote Link to comment https://forums.phpfreaks.com/topic/85184-dynamic-urls/#findComment-434591 Share on other sites More sharing options...
nikefido Posted January 9, 2008 Share Posted January 9, 2008 Is there anyother ways around it other than what is mentioned above? Whats wrong with the method above? it's annoying! (jk..er...not really) the above method is best for SEO practices. However, don't pay too much head to what you read there unless you are really trying to optimize your web site for search engines. If you want to try your hand at using .htaccess, google "mod_rewrite" and you should find examples and explanation of how it works. That is an apache use, not php specific - you may have to get your hands dirty with apache's config file to use that method (although you should be able to use it by default). The hardest part of it is using regex IMO some links on it: http://httpd.apache.org/docs/1.3/mod/mod_rewrite.html http://www.workingwith.me.uk/articles/scripting/mod_rewrite http://wettone.com/code/clean-urls http://www.phpfreaks.com/tutorials/23/1.php Quote Link to comment https://forums.phpfreaks.com/topic/85184-dynamic-urls/#findComment-434596 Share on other sites More sharing options...
adam291086 Posted January 9, 2008 Author Share Posted January 9, 2008 @ thorpe. I have no idea about htaccess. Is there away to do htaccess in php. Just my website is hosted remotely and i dont know how to do htaccess Quote Link to comment https://forums.phpfreaks.com/topic/85184-dynamic-urls/#findComment-434601 Share on other sites More sharing options...
nikefido Posted January 9, 2008 Share Posted January 9, 2008 @ thorpe. I have no idea about htaccess. Is there away to do htaccess in php. Just my website is hosted remotely and i dont know how to do htaccess .htacess is a file on the server that you need to be able to edit. Quote Link to comment https://forums.phpfreaks.com/topic/85184-dynamic-urls/#findComment-434604 Share on other sites More sharing options...
adam291086 Posted January 9, 2008 Author Share Posted January 9, 2008 rough estimate location? Quote Link to comment https://forums.phpfreaks.com/topic/85184-dynamic-urls/#findComment-434605 Share on other sites More sharing options...
adam291086 Posted January 9, 2008 Author Share Posted January 9, 2008 ok i have just found it under logs and it looks like Options +Indexes Satisfy any Order Deny,Allow Allow from 172.17.0.0/16 Allow from 212.227.35.64/27 Allow from 212.227.34.190 Deny from all RemoveType .html .gif AuthType Basic AuthName "Access for /logs" AuthUserFile /kunden/homepages/12/d214897219/htpasswd require user u46180240 do i just add in those two lines of code? Quote Link to comment https://forums.phpfreaks.com/topic/85184-dynamic-urls/#findComment-434607 Share on other sites More sharing options...
trq Posted January 9, 2008 Share Posted January 9, 2008 That .htaccess file controls the /log directory. You will need to create another within your root directory. do i just add in those two lines of code? If that is the outcome you want. You might want to take a look at the apache manual in relation to mod_rewrite. It is an extremely feature rich module. Quote Link to comment https://forums.phpfreaks.com/topic/85184-dynamic-urls/#findComment-434664 Share on other sites More sharing options...
adam291086 Posted January 9, 2008 Author Share Posted January 9, 2008 wont that only work on apache servers. I have no idea what serevers my host use. Sorry to sound dumb but i want to get this clear in my head before i attempt it. Quote Link to comment https://forums.phpfreaks.com/topic/85184-dynamic-urls/#findComment-434667 Share on other sites More sharing options...
revraz Posted January 9, 2008 Share Posted January 9, 2008 Make your news page (or other pages) seperate from your index page? Quote Link to comment https://forums.phpfreaks.com/topic/85184-dynamic-urls/#findComment-434681 Share on other sites More sharing options...
nikefido Posted January 9, 2008 Share Posted January 9, 2008 wont that only work on apache servers. I have no idea what serevers my host use. Sorry to sound dumb but i want to get this clear in my head before i attempt it. correct - since you are running PHP, you are most likely using apache, however. if you want, you can make a test .php file with just this: <?php phpinfo(); ?> and run that file - it will show you all your php info, including what kind of server it is being run on. What you need to do is make a crash course in RegEx (regular expressions) - consider asking about them in the php/regex section of this forum. you also need to make a text file and name it ".htaccess" and then place it in the root folder of web page (usually where your home page is). Then you can MODIFY the code given to suit your needs. you need to modify it though, because each example is specific to a web sites structure! Check out the links I posted above for some help. Quote Link to comment https://forums.phpfreaks.com/topic/85184-dynamic-urls/#findComment-434701 Share on other sites More sharing options...
trq Posted January 9, 2008 Share Posted January 9, 2008 There is a simular mod available for IIS aswell. See http://www.isapirewrite.com Quote Link to comment https://forums.phpfreaks.com/topic/85184-dynamic-urls/#findComment-434888 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.