i know this sounds crazy,but i want tomake this link more user friendly.please have a look at my links to make this rewrite
my real url looks like this.
http://localhost/cproject/support/about_cproject.php
but i want to make it looks like this
http://localhost/cproject/support/about
any help much appreciated. Thank you !
RewriteRule ^about support/about_cproject.php [NC,L]
i have used above codes for make this happen.but it didnt work
Related
forum_id forum_name
1 stuff
2 stuff
3 stuff
i have above table forum. forum.php calls it like forum.php?forum_id=? Now i have written a mod_rewrite for forum.php
RewriteRule ^forum/([0-9]+)$ forum.php?forum_id=$1 [L]
After that my url looks like example.com/forum/4. However i want my url to show forum_name not forum_id like example.com/forum/stuff. What can i do for this thing. I am gonna get forum table with forum_id because its the right method. But this time how i am gonna know what is writing inside stuff, and show it to user? I dont know if i can explain it correctly. Thanks for help
First you need to change your matching pattern:
# Match anything after "forum/" that's not a slash
RewriteRule ^forum/([^/]+) forum.php?forum_name=$1 [L]
And after that of course you need to change the database query in your PHP to select the forum by forum_name instead of forum_id.
I have tried several examples of solutions that I have found here on StackOverflow but none of them seem to work correctly.
I have a Magento store that I need to redirect an old store code url to the new one. For example:
The old url looked like this.
www.example.com/something_en
In the above example I need to be able to modify any url that contains to the path something_en and change it to something like in the next example.
www.example.com/something
Any help is much appreciated.
Make sure this is your very first rule in main .htaccess:
RewriteEngine On
RewriteRule ^something_en(/.*)?$ /something$1 [L,NC,R=301]
I have a client that has several files whose name is (for example) car.php, car_edit.php, car_review.php. These each come with query strings - so car.php?id=1234 or car_review.php?id=321. They would like the file names to be truck*.php rather than car*.php.
I'm hoping there's a way using htaccess to convert the url string to be truck*.php and use the current car*.php files. Also if possible I'd like to forward any page asking for car*.php to truck*.php.
I've done quite a bit of searching and haven't found an answer to doing this particular thing. Does anyone know how I might do this? Thanks.
You need rewrite rules. Try something like:
RewriteRule ^truck(.*).php$ /car.php?id=$1 [NC,L]
Note: This is untested, so may require tweaking.
RewriteEngine On
RewriteRule ^truck(.*)\.php$ /car$1.php [NC]
ought to do it. It should automatically transfer any URL query string like id=xxx over to the car*.php rewritten URL.
Basically I'm trying to figure out a way to make
http://www.mysite.com/check/google.com
show the contents of the page
http://www.mysite.com/check.php?site=test.com
and I want users to think that the actual URL is http://www.mysite.com/check/google.com instead of the long one.
But I need to do this in the friendliest way for Google so that they aren't looking at it as a redirect and it'll still rank well... Any help will be greatly appreciated if you can post some sample code... Thanks!
In the htaccess file in your document root, try adding:
RewriteEngine On
RewriteRule ^/?check/(.*)$ /check.php?site=$1 [L]
What I'm trying to do is rewrite something like
http://www.example.com/folderA/aaa_bb_cc_ddd.php
to
http://www.example.com/folderB/aaa-bb.php
...and I'm have just an awful time figuring out how. Any help or a point in the right direction much appreciated.
This is really going to depend on what these many URL's look like, but for starters you can try this in your htaccess file in your document root:
RewriteEngine On
RewriteRule ^/?folderA/(.*)_cc_ddd\.php /folderB/$1.php [L]
The trick here is figuring out what (.*)_cc_ddd\.php needs to look like. It's entirely dependent on this list of many URL's that you need to alter.