Forum Moderators: phranque
i have a web site and i want to make it work with Rewrite
how can i make this pages Rewrite
http://www.example.com/video/php?pt=feature
to be : http://www.example.com/feature
http://www.example.com/video/submit.php?pt=submit&part=1
to be : http://www.example.com/submit
http://www.example.com/video/index.php?pt=all
to be : http://www.example.com/all
http://www.example.com/video/categories.php?pt=categories
to be : http://www.example.com/categories
http://www.example.com/video/images.php?pt=images
to be : http://www.example.com/images
i have trying something on my .htaccess
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^([0-9a-zA-Z-]+)\,([0-9a-zA-Z-]+)\$ php?pt=feature
Help me pls
thx
[edited by: jdMorgan at 3:27 pm (utc) on Nov. 10, 2008]
[edit reason] example.com [/edit]
Options +FollowSymlinks
RewriteEngine on
#
RewriteRule ^feature$ /video/php?pt=feature [L]
RewriteRule ^submit$ /video/submit.php?pt=submit&part=1 [L]
RewriteRule ^all$ /video/index.php?pt=all [L]
RewriteRule ^(categories¦images)$ /video/$1.php?pt=$1 [L]
The last rule handles both "categories" and "images". Change the broken pipe "¦" character to a solid pipe character before use.
This code is one of two or three steps you must take. The next step is to change the links on your pages to refer to "/feature", "/submit", etc. instead of linking to the old dynamic URLs. This can be done either by ediring your database, or perhaps using php's "preg_replace" directive in the php code itself.
A third optional step is to redirect direct client requests for the old dynamic URLs back to the new static URLs. Get the first two steps working first before trying to do this, though. This step is tricky in that you must use a RewriteCond to check %{THE_REQUEST} to be sure that the dynamic URL is being requested by a client, and not a result of a previously-executed internal rewrite. It's a little complicated, but this final step prevents duplicate content issues, and speeds up the search engines' indexing of your new URLs.
Jim
jdMorgan your code not work for me
Options +FollowSymlinks
RewriteEngine on
#
RewriteRule ^feature$ /video/php?pt=feature [L]
RewriteRule ^submit$ /video/submit.php?pt=submit&part=1 [L]
RewriteRule ^all$ /video/index.php?pt=all [L]
RewriteRule ^(categories¦images)$ /video/$1.php?pt=$1 [L]
i change video TO chaabi
but code didnt work
i use .htaccess on folder example.com/chaabi/
index.php
submit.php
images.php
categories.php
videos.php
Options +FollowSymlinks
RewriteEngine on
#
RewriteRule ^([0-9a-zA-Z-]+)\,([0-9a-zA-Z-]+)\.html$ videos.php?id=$2&url=$1
RewriteRule ^feature$ /chaabi/php?pt=feature [L]
RewriteRule ^submit$ /chaabi/submit.php?pt=submit&part=1 [L]
RewriteRule ^all$ /chaabi/index.php?pt=all [L]
RewriteRule ^(categories¦images)$ /chaabi/$1.php?pt=$1 [L]
index.php
submit.php
images.php
categories.php
my web site http://example.com/chaabi/index.php
i am so sorry my english not good
[edited by: jdMorgan at 12:55 pm (utc) on Nov. 11, 2008]
[edit reason] No URLs, please. Use example.com [/edit]
If you type the URL http://example.com/chaabi/all into your browser, then you should see the page generated by your script at /chaabi/index.php?pt=all
So, how did you test?
What were the results?
How did the results differ from your expectations?
Again, for this to work, you must change the links on your pages to use the SEO-friendly "http://example.com/chaabi/all" format, you must change the broken pipe "¦" characters in the code to solid pipe characters, and you must completely flush your browser cache before testing any new code on your server.
Jim