Need Help!

Discussions about Apache mod Rewrite, .htaccess, Use, experiences ... URL Rewriting.

Moderator: Moderators

Need Help!

Postby b0sAnChE » Mon Dec 01, 2008 2:57 pm

Hy!

I have some problems to make a full working .htaccess for my page.

I have made this .htaccess

Code: Select all
Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*)-(.*)\.html$ /vise.php?program=$2&ime_programa=$1 [QSA,L]
RewriteRule download-(.*)-(.*)\.html$ /download.php?program=$1&ime_programa=$2 [QSA,L]
RewriteRule ^kategorija-(.*)-(.*)\.html$ /kategorija.php?ispis=$1&imekat=$2 [QSA,L]


I want to rewrite these dynamic URL's to static:

1. /vise.php?program=13796&ime_programa=Maxthon-Standard

I want to: /Maxthon-Standard-13796.html

2. /kategorija.php?ispis=5&imekat=Audio

I want to: /Audio-5-kategorija.html

3. /programi.php?podkategorija=384&imepodkat=Audio-CD-Player

I want to: /Audo-CD-Player-Programi-384.html

4. /opsirnije.php?vijest=1310&info=Street-Figther-HD-Remix

I want to: /Street-Fighter-HD-Remix-1310.html

5. /index-freeware-new.php

I want to: /index-freeware-new.html

Is this possible, and can somebody make a full and work .htaccess.

Thank you. Best regards.
b0sAnChE
 
Posts: 9
Joined: Mon Dec 01, 2008 2:49 pm

Advertisement

Postby SeO » Tue Dec 02, 2008 11:04 am

So, in the case where all these URI are to be used in the domain's root (example.com/uri.html), you could start with this in the domain's root .htaccess :
Code: Select all
# You may need to un-comment the following lines
# Options +FollowSymlinks
# To make sure that rewritten dir or file (/|.html) will not load dir.php in case it exist
# Options -MultiViews
# REMEBER YOU ONLY NEED TO STARD MOD REWRITE ONCE
RewriteEngine On
# REWRITE BASE
RewriteBase /


Then you need to think about how to separate a bit more you urls. For example :
/Street-Fighter-HD-Remix-1310.html
and :
/Maxthon-Standard-13796.html
are too similar to be distinguished with a RegEx.
They both are of this form alphanum-num.html so you need to find a way to distinguish them better.
For /Audio-5-kategorija.html & /Audo-CD-Player-Programi-384.html , it doable since we repeat kategorija and Programi.

So a possible standard could be :
/Maxthon-Standard-vise-13796.html
Code: Select all
RewriteRule ([a-z0-9_-]+)-vise-([0-9]+)\.html$ /vise.php?program=$2&ime_programa=$1 [QSA,L,NC]

/Audio-kategorija-5.html
Code: Select all
RewriteRule ([a-z0-9_-]+)-kategorija-([0-9]+)\.html$ /kategorija.php?ispis=$1&imekat=$1 [QSA,L,NC]

/Audo-CD-Player-Programi-384.html
Code: Select all
RewriteRule ([a-z0-9_-]+)-Programi-([0-9]+)\.html$ /programi.php?podkategorija=$2&imepodkat=$1 [QSA,L,NC]

/Street-Fighter-HD-Remix-opsirnije-1310.html
Code: Select all
RewriteRule ([a-z0-9_-]+)-opsirnije-([0-9]+)\.html$ /opsirnije.php?vijest=$2&info=$1 [QSA,L,NC]

/index-freeware-new.html (must be at the end of the .htaccess)
Code: Select all
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ([a-z0-9_-]+)\.html$ /$1.php [QSA,L,NC]


;)
SeO
Admin
Admin
 
Posts: 6333
Joined: Wed Mar 15, 2006 9:41 pm

thx

Postby b0sAnChE » Tue Dec 02, 2008 11:12 am

i will try this out now. and reply with the result of it.

thanx
b0sAnChE
 
Posts: 9
Joined: Mon Dec 01, 2008 2:49 pm

thank you

Postby b0sAnChE » Tue Dec 02, 2008 11:34 am

as far as i have seen all the rules works.

how can i say thanks to you? i don+t see any ads, so that i can click on some of that.

great job man.
b0sAnChE
 
Posts: 9
Joined: Mon Dec 01, 2008 2:49 pm

Postby SeO » Tue Dec 02, 2008 12:49 pm

You're welcome :D

About adds, the idea is to only click on those that really interest you, nothing more, since it could actually become problematic otherwise.

If you feel thankful, you can participate more in our forums, would be a great occasion to learn a bit more too ;)
SeO
Admin
Admin
 
Posts: 6333
Joined: Wed Mar 15, 2006 9:41 pm

Some Problems

Postby b0sAnChE » Tue Dec 02, 2008 3:48 pm

After i have made changes in my web page script, i have some errors on some pages

Take a look at:

http://www.download.co.ba/Vista-Transfo ... -8720.html

Originaly was: http://www.download.co.ba/vise.php?prog ... Pack-8.0.1

Take a look at the title. :((

Can that be fixed with the .htaccess

Best regards
b0sAnChE
 
Posts: 9
Joined: Mon Dec 01, 2008 2:49 pm

Postby SeO » Wed Dec 03, 2008 7:49 am

No page titles are built in the script, the .htaccess can do nothing about it.

By the way, you can replace the static part in your url, for example :
/Maxthon-Standard-vise-13796.html
could be :
/Maxthon-Standard-somethingelse-13796.html
as long as you edit the corresponding rewriterule acconrdingly :
RewriteRule ([a-z0-9_-]+)-somethingelse-([0-9]+)\.html$ /vise.php?program=$2&ime_programa=$1 [QSA,L,NC]


And so on if you prefer.
SeO
Admin
Admin
 
Posts: 6333
Joined: Wed Mar 15, 2006 9:41 pm

thx

Postby b0sAnChE » Wed Dec 03, 2008 7:52 am

i have made yesterday some changes in the header, and i have fixed some bug's.

this works still fine, and i'm going to make more changes in my own web site script, to make the page full work with the new URL's.

thank you.
b0sAnChE
 
Posts: 9
Joined: Mon Dec 01, 2008 2:49 pm

Re: Some Problems

Postby b0sAnChE » Wed Dec 03, 2008 7:54 am

b0sAnChE wrote:After i have made changes in my web page script, i have some errors on some pages

Take a look at:

http://www.download.co.ba/Vista-Transfo ... -8720.html

Originaly was: http://www.download.co.ba/vise.php?prog ... Pack-8.0.1

Take a look at the title. :((

Can that be fixed with the .htaccess

Best regards


as you can see on the links, the name of the software appears yet in the title bar.

i have only some problem's with special characters like: ' or () and so on.
b0sAnChE
 
Posts: 9
Joined: Mon Dec 01, 2008 2:49 pm

Postby SeO » Wed Dec 03, 2008 10:12 am

In urls you mean ?
Only alphanumerical characters (no accent) can be used in url without trouble. You have to filter the titles before you inject them in urls.
SeO
Admin
Admin
 
Posts: 6333
Joined: Wed Mar 15, 2006 9:41 pm

hy

Postby b0sAnChE » Wed Dec 03, 2008 11:26 am

thank you, i will try to make a filter in the header that changes special signes in to normal signs. .)
b0sAnChE
 
Posts: 9
Joined: Mon Dec 01, 2008 2:49 pm

Postby SeO » Wed Dec 03, 2008 2:04 pm

You can take a look at how it is done in our phpBB SEO mods (SEO URL ones, phpbb_seo::format_url in phpbb_seo/phpbb_seo_class.php) ;)
SeO
Admin
Admin
 
Posts: 6333
Joined: Wed Mar 15, 2006 9:41 pm

Re: Need Help!

Postby b0sAnChE » Sat Oct 10, 2009 12:04 pm

Hi my friends!

Here i am again :)

I have some troubles with my .htaccess and the url rewrite thing :((

Here is the original url:

-www.somedomain.com/info.php?app=IDOfTheApp&app_tittle=TheTitleOfTheApp

How can i change the .htaccess to make a url like this:

-www.somedomain.com/info/TheTitleOfTheApp/IDOfTheApp

Best regards!
b0sAnChE
 
Posts: 9
Joined: Mon Dec 01, 2008 2:49 pm

Re: Need Help!

Postby dcz » Sun Oct 18, 2009 12:32 pm

You could use :
Code: Select all
RewriteRule ^test/([a-z0-9_-]+)/([a-z0-9_-]+)/$ /test.php?app=$1&app_tittle=$2 [QSA,L,NC]

or :
Code: Select all
RewriteRule ^test(/([a-z0-9_-]+))?(/([a-z0-9_-]+))?/?$ /test.php?app=$2&app_tittle=$4 [QSA,L,NC]

if app and app_tittle can be empty.
note that if IDOfTheApp is an integer, you should use :
Code: Select all
RewriteRule ^test/([0-9]+)/([a-z0-9_-]+)/$ /test.php?app=$1&app_tittle=$2 [QSA,L,NC]

or :
Code: Select all
RewriteRule ^test(/([0-9]+))?(/([a-z0-9_-]+))?/?$ /test.php?app=$2&app_tittle=$4 [QSA,L,NC]


++
Useful links :
SEO Forum || SEO Directory || SEO phpBB || Search
____________________

Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Recherche
dcz
Admin
Admin
 
Posts: 21219
Joined: Fri Apr 28, 2006 9:03 pm

Re: Need Help!

Postby b0sAnChE » Sat Sep 04, 2010 12:10 pm

Hi phpBB SEO Members!

I have a few questions.

The last time, you have helped me out, to figure out the rewrite of my url's. Thank you.

Yet, i have a question about wildcards and rewrite:

Is it possible to rewrite my URL's to something like this:

example:

Code: Select all
Original : http://www.download.ba/mozilla-firefox/

to this type:

Wished URL: http://mozilla-firefox.download.ba ?


If I need to post my .htaccess let me know.

Best Regards.
b0sAnChE
 
Posts: 9
Joined: Mon Dec 01, 2008 2:49 pm


Return to Apache mod Rewrite

Who is online

Users browsing this forum: No registered users and 3 guests