Jump to content

Recommended Posts

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?

Link to comment
https://forums.phpfreaks.com/topic/85184-dynamic-urls/
Share on other sites

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

Link to comment
https://forums.phpfreaks.com/topic/85184-dynamic-urls/#findComment-434596
Share on other sites

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?

 

 

Link to comment
https://forums.phpfreaks.com/topic/85184-dynamic-urls/#findComment-434607
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/85184-dynamic-urls/#findComment-434664
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/85184-dynamic-urls/#findComment-434701
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.