sauravrawal Posted April 4, 2010 Posted April 4, 2010 i want to rewrite the url as following ? http://hamroworld.com/mypage into http://hamroworld.com/profile.php?profile=mypage For example: if someone enters http://hamroworld.com/mypage he/she should get the content of hamroworld.com/profile.php?profile=mypage How to do this ?please help me here I have headache because of this ! Quote
Byron Posted April 4, 2010 Posted April 4, 2010 You can do that at your cpanel. Just look for the link that says Redirects. It should write something like this into your htaccess file: RewriteEngine on RewriteCond %{HTTP_HOST} ^hamroworld.com$ [OR] RewriteCond %{HTTP_HOST} ^www.hamroworld.com$ RewriteRule ^mypage$ "http\:\/\/profile\.php\?profile\=mypage" [R=301,L] Quote
sauravrawal Posted April 5, 2010 Author Posted April 5, 2010 You can do that at your cpanel. Just look for the link that says Redirects. It should write something like this into your htaccess file: RewriteEngine on RewriteCond %{HTTP_HOST} ^hamroworld.com$ [OR] RewriteCond %{HTTP_HOST} ^www.hamroworld.com$ RewriteRule ^mypage$ "http\:\/\/profile\.php\?profile\=mypage" [R=301,L] Thanks but i want to rewrite hamroworld.com/anyvariable to hamroword.com/profile.php?profile=anyvariable It is not only 'mypage' I waiting for your help again Quote
Byron Posted April 5, 2010 Posted April 5, 2010 I'm not to good with regex so if no one answers your question here you can make a post in this forum under "Apache configuration" http://www.codingforums.com/ I'm sure somebody there can help you. Quote
DamegedSpy Posted April 6, 2010 Posted April 6, 2010 Had you done the PHP File? It should be simple: $_GET['page'] And querying the db for the contents. Just watch out for vulnerabilities. You can always learn PHP at http://w3schools.com After checking the website, do you mean more like restricting the pages to friends? Quote
sauravrawal Posted April 7, 2010 Author Posted April 7, 2010 Had you done the PHP File? It should be simple: $_GET['page'] And querying the db for the contents. Just watch out for vulnerabilities. You can always learn PHP at http://w3schools.com After checking the website, do you mean more like restricting the pages to friends? Everything done only .htaccess remaining to work for me! Quote
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.